New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <parent> |
| | | <groupId>com.stylefeng</groupId> |
| | | <artifactId>guns-parent</artifactId> |
| | | <version>1.0.0</version> |
| | | <relativePath>../pom.xml</relativePath> |
| | | </parent> |
| | | |
| | | <artifactId>guns-admin</artifactId> |
| | | <name>guns-admin</name> |
| | | <description>guns 的spring boot版本</description> |
| | | |
| | | <packaging>jar</packaging> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
| | | <version>5.7.17</version> |
| | | </dependency> |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> |
| | | </dependency> |
| | | <!--整合hystrix--> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.stylefeng</groupId> |
| | | <artifactId>guns-core</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.stylefeng</groupId> |
| | | <artifactId>guns-generator</artifactId> |
| | | </dependency> |
| | | |
| | | <!--spring boot依赖--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-aop</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-cache</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-validation</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-devtools</artifactId> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.fasterxml.jackson.core</groupId> |
| | | <artifactId>jackson-core</artifactId> |
| | | <version>2.11.3</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-tomcat</artifactId> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>javax.servlet</groupId> |
| | | <artifactId>javax.servlet-api</artifactId> |
| | | <version>3.1.0</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | |
| | | |
| | | <!--shiro依赖--> |
| | | <dependency> |
| | | <groupId>org.apache.shiro</groupId> |
| | | <artifactId>shiro-core</artifactId> |
| | | <exclusions> |
| | | <exclusion> |
| | | <artifactId>slf4j-api</artifactId> |
| | | <groupId>org.slf4j</groupId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.shiro</groupId> |
| | | <artifactId>shiro-spring</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.shiro</groupId> |
| | | <artifactId>shiro-ehcache</artifactId> |
| | | <exclusions> |
| | | <exclusion> |
| | | <artifactId>slf4j-api</artifactId> |
| | | <groupId>org.slf4j</groupId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.ehcache</groupId> |
| | | <artifactId>ehcache</artifactId> |
| | | </dependency> |
| | | |
| | | <!--需要分布式session的话需要放开注释--> |
| | | <!--<dependency>--> |
| | | <!--<groupId>org.springframework.session</groupId>--> |
| | | <!--<artifactId>spring-session-data-redis</artifactId>--> |
| | | <!--</dependency>--> |
| | | <!--<dependency>--> |
| | | <!--<groupId>org.springframework.boot</groupId>--> |
| | | <!--<artifactId>spring-boot-starter-data-redis</artifactId>--> |
| | | <!--</dependency>--> |
| | | |
| | | <dependency> |
| | | <groupId>com.github.penggle</groupId> |
| | | <artifactId>kaptcha</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>core</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ibeetl</groupId> |
| | | <artifactId>beetl</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger2</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger-ui</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>io.jsonwebtoken</groupId> |
| | | <artifactId>jjwt</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>redis.clients</groupId> |
| | | <artifactId>jedis</artifactId> |
| | | <version>2.9.0</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>dom4j</groupId> |
| | | <artifactId>dom4j</artifactId> |
| | | <version>1.6.1</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.alipay.sdk</groupId> |
| | | <artifactId>alipay-sdk-java</artifactId> |
| | | <version>4.8.10.ALL</version> |
| | | </dependency> |
| | | <!-- oos对象存储 --> |
| | | <dependency> |
| | | <groupId>com.aliyun.oss</groupId> |
| | | <artifactId>aliyun-sdk-oss</artifactId> |
| | | <version>3.8.0</version> |
| | | </dependency> |
| | | <!--华为云的obs--> |
| | | <dependency> |
| | | <groupId>com.huaweicloud</groupId> |
| | | <artifactId>esdk-obs-java</artifactId> |
| | | <version>3.19.5</version> |
| | | </dependency> |
| | | <!-- https://mvnrepository.com/artifact/com.aliyun/aliyun-java-sdk-core --> |
| | | <dependency> |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>aliyun-java-sdk-core</artifactId> |
| | | <version>4.4.3</version> |
| | | </dependency> |
| | | |
| | | <!-- 计算两坐标间的直线距离 --> |
| | | <dependency> |
| | | <groupId>org.gavaghan</groupId> |
| | | <artifactId>geodesy</artifactId> |
| | | <version>1.1.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-test</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | |
| | | <build> |
| | | <!--打包jar包方式--> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <configuration> |
| | | <fork>true</fork><!-- 如果没有该项配置,肯呢个devtools不会起作用,即应用不会restart --> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | |
| | | <!--打包war包引入本地jar的打包方式--> |
| | | <!--<plugins>--> |
| | | <!--<plugin>--> |
| | | <!--<groupId>org.apache.maven.plugins</groupId>--> |
| | | <!--<artifactId>maven-war-plugin</artifactId>--> |
| | | <!--<configuration>--> |
| | | <!--<!– 设置成false,否则检查web.xml是否存在。因为springboot是没有web.xml的 –>--> |
| | | <!--<failOnMissingWebXml>false</failOnMissingWebXml>--> |
| | | <!--<!–打包后的项目名–>--> |
| | | <!--<!–<warName>example</warName>–>--> |
| | | <!--<webResources>--> |
| | | <!--<resource>--> |
| | | <!--<!–把本地lib里面的jar复制到lib–>--> |
| | | <!--<directory>${project.basedir}/lib</directory>--> |
| | | <!--<targetPath>WEB-INF/lib/</targetPath>--> |
| | | <!--<includes>--> |
| | | <!--<include>**/*.jar</include>--> |
| | | <!--</includes>--> |
| | | <!--</resource>--> |
| | | <!--</webResources>--> |
| | | <!--</configuration>--> |
| | | <!--</plugin>--> |
| | | <!--</plugins>--> |
| | | |
| | | |
| | | <resources> |
| | | <resource> |
| | | <directory>lib</directory> |
| | | <targetPath>/BOOT-INF/lib/</targetPath> |
| | | <includes> |
| | | <include>**/*.jar</include> |
| | | </includes> |
| | | </resource> |
| | | <resource> |
| | | <directory>src/main/webapp</directory> |
| | | </resource> |
| | | <resource> |
| | | <directory>src/main/resources</directory> |
| | | <filtering>true</filtering> |
| | | </resource> |
| | | <resource> |
| | | <directory>src/main/java</directory> |
| | | <includes> |
| | | <include>**/*.xml</include> |
| | | </includes> |
| | | </resource> |
| | | </resources> |
| | | </build> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.stylefeng.guns; |
| | | |
| | | import org.apache.http.client.HttpClient; |
| | | import org.apache.http.config.SocketConfig; |
| | | import org.apache.http.impl.client.HttpClientBuilder; |
| | | import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.builder.SpringApplicationBuilder; |
| | | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
| | | import org.springframework.cloud.client.loadbalancer.LoadBalanced; |
| | | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; |
| | | import org.springframework.http.converter.StringHttpMessageConverter; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.nio.charset.StandardCharsets; |
| | | |
| | | /** |
| | | * SpringBoot方式启动类 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/21 12:06 |
| | | */ |
| | | @EnableEurekaClient//注册为服务提供者 |
| | | @SpringBootApplication |
| | | @EnableScheduling//开启定时任务 |
| | | @EnableTransactionManagement//启动事务功能 |
| | | public class GunsApplication /*extends SpringBootServletInitializer*/ { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(GunsApplication.class); |
| | | |
| | | public static void main(String[] args) { |
| | | // try { |
| | | |
| | | |
| | | SpringApplication.run(GunsApplication.class, args); |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // } |
| | | logger.info("GunsApplication is success!"); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 向Spring容器中定义RestTemplate对象 |
| | | * @return |
| | | */ |
| | | @Bean //SpringCloud内部服务质检使用服务名调用 |
| | | @LoadBalanced |
| | | public RestTemplate internalRestTemplate() { |
| | | PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(); |
| | | connectionManager.setDefaultSocketConfig(SocketConfig.custom().setTcpNoDelay(true).build()); |
| | | connectionManager.setDefaultMaxPerRoute(100);//最大并发连接 |
| | | connectionManager.setMaxTotal(200); // 总的最大连接数 |
| | | HttpClient httpClient = HttpClientBuilder.create().setConnectionManager(connectionManager).build(); |
| | | HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory(httpClient); |
| | | httpRequestFactory.setConnectionRequestTimeout(30 * 1000); |
| | | httpRequestFactory.setConnectTimeout(30 * 3000); |
| | | httpRequestFactory.setReadTimeout(30 * 3000); |
| | | RestTemplate restTemplate = new RestTemplate(httpRequestFactory); |
| | | restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); |
| | | return restTemplate; |
| | | } |
| | | |
| | | @Bean //通过ip地址调用 |
| | | public RestTemplate restTemplate() { |
| | | PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(); |
| | | connectionManager.setDefaultSocketConfig(SocketConfig.custom().setTcpNoDelay(true).build()); |
| | | connectionManager.setDefaultMaxPerRoute(100);//最大并发连接 |
| | | connectionManager.setMaxTotal(200); // 总的最大连接数 |
| | | HttpClient httpClient = HttpClientBuilder.create().setConnectionManager(connectionManager).build(); |
| | | HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory(httpClient); |
| | | httpRequestFactory.setConnectionRequestTimeout(30 * 1000); |
| | | httpRequestFactory.setConnectTimeout(30 * 3000); |
| | | httpRequestFactory.setReadTimeout(30 * 3000); |
| | | RestTemplate restTemplate = new RestTemplate(httpRequestFactory); |
| | | restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); |
| | | return restTemplate; |
| | | } |
| | | |
| | | |
| | | // @Override |
| | | // protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { |
| | | // return builder.sources(GunsApplication.class); |
| | | // } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns; |
| | | |
| | | import org.springframework.boot.builder.SpringApplicationBuilder; |
| | | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
| | | |
| | | /** |
| | | * Guns Web程序启动类 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-21 9:43 |
| | | */ |
| | | public class GunsServletInitializer extends SpringBootServletInitializer { |
| | | |
| | | @Override |
| | | protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { |
| | | return builder.sources(GunsApplication.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.config; |
| | | |
| | | import net.sf.ehcache.CacheManager; |
| | | import org.springframework.cache.annotation.EnableCaching; |
| | | import org.springframework.cache.ehcache.EhCacheCacheManager; |
| | | import org.springframework.cache.ehcache.EhCacheManagerFactoryBean; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.core.io.ClassPathResource; |
| | | |
| | | /** |
| | | * ehcache配置 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-20 23:11 |
| | | */ |
| | | @Configuration |
| | | @EnableCaching |
| | | public class EhCacheConfig { |
| | | |
| | | /** |
| | | * EhCache的配置 |
| | | */ |
| | | @Bean |
| | | public EhCacheCacheManager cacheManager(CacheManager cacheManager) { |
| | | return new EhCacheCacheManager(cacheManager); |
| | | } |
| | | |
| | | /** |
| | | * EhCache的配置 |
| | | */ |
| | | @Bean |
| | | public EhCacheManagerFactoryBean ehcache() { |
| | | EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean(); |
| | | ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml")); |
| | | ehCacheManagerFactoryBean.setShared(true);//共享缓存,避免tomcat启动报错 |
| | | return ehCacheManagerFactoryBean; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.config; |
| | | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.context.annotation.PropertySource; |
| | | import redis.clients.jedis.JedisPool; |
| | | import redis.clients.jedis.JedisPoolConfig; |
| | | |
| | | @Configuration |
| | | @PropertySource("classpath:redis.properties") |
| | | public class RedisConfig { |
| | | @Value("${spring.redis.host}") |
| | | private String host; |
| | | |
| | | @Value("${spring.redis.port}") |
| | | private int port; |
| | | |
| | | @Value("${spring.redis.timeout}") |
| | | private int timeout; |
| | | |
| | | @Value("${spring.redis.jedis.pool.max-idle}") |
| | | private int maxIdle; |
| | | |
| | | @Value("${spring.redis.jedis.pool.max-wait}") |
| | | private long maxWaitMillis; |
| | | |
| | | @Value("${spring.redis.password}") |
| | | private String password; |
| | | |
| | | @Value("${spring.redis.block-when-exhausted}") |
| | | private boolean blockWhenExhausted; |
| | | |
| | | @Bean |
| | | public JedisPool redisPoolFactory() throws Exception{ |
| | | JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); |
| | | jedisPoolConfig.setMaxIdle(maxIdle); |
| | | jedisPoolConfig.setMaxWaitMillis(maxWaitMillis); |
| | | // 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true |
| | | jedisPoolConfig.setBlockWhenExhausted(blockWhenExhausted); |
| | | // 是否启用pool的jmx管理功能, 默认true |
| | | jedisPoolConfig.setJmxEnabled(true); |
| | | JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout, password); |
| | | return jedisPool; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.config; |
| | | |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | |
| | | /** |
| | | * spring session配置 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-07-13 21:05 |
| | | */ |
| | | //@EnableRedisHttpSession(maxInactiveIntervalInSeconds = 1800) //session过期时间 如果部署多机环境,需要打开注释 |
| | | @ConditionalOnProperty(prefix = "guns", name = "spring-session-open", havingValue = "true") |
| | | public class SpringSessionConfig { |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.config; |
| | | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import springfox.documentation.builders.ApiInfoBuilder; |
| | | import springfox.documentation.builders.PathSelectors; |
| | | import springfox.documentation.builders.RequestHandlerSelectors; |
| | | import springfox.documentation.service.ApiInfo; |
| | | import springfox.documentation.spi.DocumentationType; |
| | | import springfox.documentation.spring.web.plugins.Docket; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | /** |
| | | * swagger配置类 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017年6月1日19:42:59 |
| | | */ |
| | | @Configuration |
| | | @EnableSwagger2 |
| | | @ConditionalOnProperty(prefix = "guns", name = "swagger-open", havingValue = "true") |
| | | public class SwaggerConfig{ |
| | | |
| | | @Bean |
| | | public Docket createRestApi() { |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | .apiInfo(apiInfo()) |
| | | .select() |
| | | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) //这里采用包含注解的方式来确定要显示的接口 |
| | | //.apis(RequestHandlerSelectors.basePackage("com.stylefeng.guns.modular.system.controller")) //这里采用包扫描的方式来确定要显示的接口 |
| | | .paths(PathSelectors.any()) |
| | | .build(); |
| | | } |
| | | |
| | | private ApiInfo apiInfo() { |
| | | return new ApiInfoBuilder() |
| | | .title("未来出行 Doc") |
| | | .description("所有接口前需要加 /user 前缀,例如:/user/base/agreement/queryByType <br>" + |
| | | "所有以 /api/*** 路径的接口需要上传签名参数sign") |
| | | // .termsOfServiceUrl("http://git.oschina.net/naan1993/guns") |
| | | .contact("stylefeng") |
| | | .version("1.0") |
| | | .build(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.config.datasource; |
| | | |
| | | import com.alibaba.druid.pool.DruidDataSource; |
| | | import com.baomidou.mybatisplus.plugins.OptimisticLockerInterceptor; |
| | | import com.baomidou.mybatisplus.plugins.PaginationInterceptor; |
| | | import com.stylefeng.guns.core.config.properties.DruidProperties; |
| | | import com.stylefeng.guns.core.config.properties.MutiDataSourceProperties; |
| | | import com.stylefeng.guns.core.datascope.DataScopeInterceptor; |
| | | import com.stylefeng.guns.core.mutidatasource.DynamicDataSource; |
| | | import com.stylefeng.guns.core.mutidatasource.aop.MultiSourceExAop; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | | import java.sql.SQLException; |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | | * 多数据源配置<br/> |
| | | * <p> |
| | | * 注:由于引入多数据源,所以让spring事务的aop要在多数据源切换aop的后面 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/20 21:58 |
| | | */ |
| | | @Configuration |
| | | @ConditionalOnProperty(prefix = "guns.muti-datasource", name = "open", havingValue = "true") |
| | | @EnableTransactionManagement(order = 2) |
| | | @MapperScan(basePackages = {"com.stylefeng.guns.modular.*.dao","com.stylefeng.guns.multi.mapper"}) |
| | | public class MultiDataSourceConfig { |
| | | |
| | | @Bean |
| | | @ConfigurationProperties(prefix = "guns.muti-datasource") |
| | | public MutiDataSourceProperties mutiDataSourceProperties() { |
| | | return new MutiDataSourceProperties(); |
| | | } |
| | | |
| | | @Bean |
| | | public MultiSourceExAop multiSourceExAop() { |
| | | return new MultiSourceExAop(); |
| | | } |
| | | |
| | | /** |
| | | * guns的数据源 |
| | | */ |
| | | private DruidDataSource dataSource(DruidProperties druidProperties) { |
| | | DruidDataSource dataSource = new DruidDataSource(); |
| | | druidProperties.config(dataSource); |
| | | return dataSource; |
| | | } |
| | | |
| | | /** |
| | | * 多数据源,第二个数据源 |
| | | */ |
| | | private DruidDataSource bizDataSource(DruidProperties druidProperties, MutiDataSourceProperties mutiDataSourceProperties) { |
| | | DruidDataSource dataSource = new DruidDataSource(); |
| | | druidProperties.config(dataSource); |
| | | mutiDataSourceProperties.config(dataSource); |
| | | return dataSource; |
| | | } |
| | | |
| | | /** |
| | | * 多数据源连接池配置 |
| | | */ |
| | | @Bean |
| | | public DynamicDataSource mutiDataSource(DruidProperties druidProperties, MutiDataSourceProperties mutiDataSourceProperties) { |
| | | |
| | | DruidDataSource dataSourceGuns = dataSource(druidProperties); |
| | | DruidDataSource bizDataSource = bizDataSource(druidProperties, mutiDataSourceProperties); |
| | | |
| | | try { |
| | | dataSourceGuns.init(); |
| | | bizDataSource.init(); |
| | | } catch (SQLException sql) { |
| | | sql.printStackTrace(); |
| | | } |
| | | |
| | | DynamicDataSource dynamicDataSource = new DynamicDataSource(); |
| | | HashMap<Object, Object> hashMap = new HashMap<>(); |
| | | hashMap.put(mutiDataSourceProperties.getDataSourceNames()[0], dataSourceGuns); |
| | | hashMap.put(mutiDataSourceProperties.getDataSourceNames()[1], bizDataSource); |
| | | dynamicDataSource.setTargetDataSources(hashMap); |
| | | dynamicDataSource.setDefaultTargetDataSource(dataSourceGuns); |
| | | return dynamicDataSource; |
| | | } |
| | | |
| | | /** |
| | | * mybatis-plus分页插件 |
| | | */ |
| | | @Bean |
| | | public PaginationInterceptor paginationInterceptor() { |
| | | return new PaginationInterceptor(); |
| | | } |
| | | |
| | | /** |
| | | * 数据范围mybatis插件 |
| | | */ |
| | | @Bean |
| | | public DataScopeInterceptor dataScopeInterceptor() { |
| | | return new DataScopeInterceptor(); |
| | | } |
| | | |
| | | /** |
| | | * 乐观锁mybatis插件 |
| | | */ |
| | | @Bean |
| | | public OptimisticLockerInterceptor optimisticLockerInterceptor() { |
| | | return new OptimisticLockerInterceptor(); |
| | | } |
| | | |
| | | /** |
| | | * 事务配置 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2018/6/27 23:11 |
| | | */ |
| | | @Bean |
| | | public DataSourceTransactionManager dataSourceTransactionManager(DynamicDataSource mutiDataSource) { |
| | | return new DataSourceTransactionManager(mutiDataSource); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.config.datasource; |
| | | |
| | | import com.alibaba.druid.pool.DruidDataSource; |
| | | import com.baomidou.mybatisplus.plugins.OptimisticLockerInterceptor; |
| | | import com.baomidou.mybatisplus.plugins.PaginationInterceptor; |
| | | import com.stylefeng.guns.core.config.properties.DruidProperties; |
| | | import com.stylefeng.guns.core.datascope.DataScopeInterceptor; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | | /** |
| | | * 多数据源配置 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/20 21:58 |
| | | */ |
| | | @Configuration |
| | | @ConditionalOnProperty(prefix = "guns.muti-datasource", name = "open", havingValue = "false", matchIfMissing = true) |
| | | @EnableTransactionManagement |
| | | @MapperScan(basePackages = {"com.stylefeng.guns.modular.*.dao"}) |
| | | public class SingleDataSourceConfig { |
| | | |
| | | /** |
| | | * 单数据源连接池配置 |
| | | */ |
| | | @Bean |
| | | public DruidDataSource dataSource(DruidProperties druidProperties) { |
| | | DruidDataSource dataSource = new DruidDataSource(); |
| | | druidProperties.config(dataSource); |
| | | return dataSource; |
| | | } |
| | | |
| | | /** |
| | | * mybatis-plus分页插件 |
| | | */ |
| | | @Bean |
| | | public PaginationInterceptor paginationInterceptor() { |
| | | return new PaginationInterceptor(); |
| | | } |
| | | |
| | | /** |
| | | * 数据范围mybatis插件 |
| | | */ |
| | | @Bean |
| | | public DataScopeInterceptor dataScopeInterceptor() { |
| | | return new DataScopeInterceptor(); |
| | | } |
| | | |
| | | /** |
| | | * 乐观锁mybatis插件 |
| | | */ |
| | | @Bean |
| | | public OptimisticLockerInterceptor optimisticLockerInterceptor() { |
| | | return new OptimisticLockerInterceptor(); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.stylefeng.guns.config.properties; |
| | | |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.util.Properties; |
| | | |
| | | /** |
| | | * beetl配置(如果需要配置别的配置可参照这个形式自己添加) |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-24 20:37 |
| | | */ |
| | | @Configuration |
| | | @ConfigurationProperties(prefix = BeetlProperties.BEETLCONF_PREFIX) |
| | | public class BeetlProperties { |
| | | |
| | | public static final String BEETLCONF_PREFIX = "beetl"; |
| | | |
| | | private String delimiterStatementStart; |
| | | |
| | | private String delimiterStatementEnd; |
| | | |
| | | private String resourceTagroot; |
| | | |
| | | private String resourceTagsuffix; |
| | | |
| | | private String resourceAutoCheck; |
| | | |
| | | @Value("${spring.mvc.view.prefix}") |
| | | private String prefix; |
| | | |
| | | public Properties getProperties(){ |
| | | Properties properties = new Properties(); |
| | | if(ToolUtil.isNotEmpty(delimiterStatementStart)){ |
| | | if(delimiterStatementStart.startsWith("\\")){ |
| | | delimiterStatementStart = delimiterStatementStart.substring(1); |
| | | } |
| | | properties.setProperty("DELIMITER_STATEMENT_START",delimiterStatementStart); |
| | | } |
| | | if(ToolUtil.isNotEmpty(delimiterStatementEnd)){ |
| | | properties.setProperty("DELIMITER_STATEMENT_END",delimiterStatementEnd); |
| | | }else{ |
| | | properties.setProperty("DELIMITER_STATEMENT_END","null"); |
| | | } |
| | | if(ToolUtil.isNotEmpty(resourceTagroot)){ |
| | | properties.setProperty("RESOURCE.tagRoot",resourceTagroot); |
| | | } |
| | | if(ToolUtil.isNotEmpty(resourceTagsuffix)){ |
| | | properties.setProperty("RESOURCE.tagSuffix",resourceTagsuffix); |
| | | } |
| | | if(ToolUtil.isNotEmpty(resourceAutoCheck)){ |
| | | properties.setProperty("RESOURCE.autoCheck",resourceAutoCheck); |
| | | } |
| | | return properties; |
| | | } |
| | | |
| | | public String getPrefix() { |
| | | return prefix; |
| | | } |
| | | |
| | | public String getDelimiterStatementStart() { |
| | | return delimiterStatementStart; |
| | | } |
| | | |
| | | public void setDelimiterStatementStart(String delimiterStatementStart) { |
| | | this.delimiterStatementStart = delimiterStatementStart; |
| | | } |
| | | |
| | | public String getDelimiterStatementEnd() { |
| | | return delimiterStatementEnd; |
| | | } |
| | | |
| | | public void setDelimiterStatementEnd(String delimiterStatementEnd) { |
| | | this.delimiterStatementEnd = delimiterStatementEnd; |
| | | } |
| | | |
| | | public String getResourceTagroot() { |
| | | return resourceTagroot; |
| | | } |
| | | |
| | | public void setResourceTagroot(String resourceTagroot) { |
| | | this.resourceTagroot = resourceTagroot; |
| | | } |
| | | |
| | | public String getResourceTagsuffix() { |
| | | return resourceTagsuffix; |
| | | } |
| | | |
| | | public void setResourceTagsuffix(String resourceTagsuffix) { |
| | | this.resourceTagsuffix = resourceTagsuffix; |
| | | } |
| | | |
| | | public String getResourceAutoCheck() { |
| | | return resourceAutoCheck; |
| | | } |
| | | |
| | | public void setResourceAutoCheck(String resourceAutoCheck) { |
| | | this.resourceAutoCheck = resourceAutoCheck; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.config.properties; |
| | | |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.File; |
| | | |
| | | import static com.stylefeng.guns.core.util.ToolUtil.getTempPath; |
| | | import static com.stylefeng.guns.core.util.ToolUtil.isEmpty; |
| | | |
| | | /** |
| | | * guns项目配置 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/23 22:31 |
| | | */ |
| | | @Component |
| | | @ConfigurationProperties(prefix = GunsProperties.PREFIX) |
| | | public class GunsProperties { |
| | | |
| | | public static final String PREFIX = "guns"; |
| | | |
| | | private Boolean kaptchaOpen = false; |
| | | |
| | | private Boolean swaggerOpen = false; |
| | | |
| | | private String fileUploadPath; |
| | | |
| | | private Boolean haveCreatePath = false; |
| | | |
| | | private Boolean springSessionOpen = false; |
| | | |
| | | /** |
| | | * session 失效时间(默认为30分钟 单位:秒) |
| | | */ |
| | | private Integer sessionInvalidateTime = 30 * 60; |
| | | |
| | | /** |
| | | * session 验证失效时间(默认为15分钟 单位:秒) |
| | | */ |
| | | private Integer sessionValidationInterval = 15 * 60; |
| | | |
| | | public String getFileUploadPath() { |
| | | //如果没有写文件上传路径,保存到临时目录 |
| | | if (isEmpty(fileUploadPath)) { |
| | | return getTempPath(); |
| | | } else { |
| | | //判断有没有结尾符,没有得加上 |
| | | if (!fileUploadPath.endsWith(File.separator)) { |
| | | fileUploadPath = fileUploadPath + File.separator; |
| | | } |
| | | //判断目录存不存在,不存在得加上 |
| | | if (!haveCreatePath) { |
| | | File file = new File(fileUploadPath); |
| | | file.mkdirs(); |
| | | haveCreatePath = true; |
| | | } |
| | | return fileUploadPath; |
| | | } |
| | | } |
| | | |
| | | public void setFileUploadPath(String fileUploadPath) { |
| | | this.fileUploadPath = fileUploadPath; |
| | | } |
| | | |
| | | public Boolean getKaptchaOpen() { |
| | | return kaptchaOpen; |
| | | } |
| | | |
| | | public void setKaptchaOpen(Boolean kaptchaOpen) { |
| | | this.kaptchaOpen = kaptchaOpen; |
| | | } |
| | | |
| | | public Boolean getSwaggerOpen() { |
| | | return swaggerOpen; |
| | | } |
| | | |
| | | public void setSwaggerOpen(Boolean swaggerOpen) { |
| | | this.swaggerOpen = swaggerOpen; |
| | | } |
| | | |
| | | public Boolean getSpringSessionOpen() { |
| | | return springSessionOpen; |
| | | } |
| | | |
| | | public void setSpringSessionOpen(Boolean springSessionOpen) { |
| | | this.springSessionOpen = springSessionOpen; |
| | | } |
| | | |
| | | public Integer getSessionInvalidateTime() { |
| | | return sessionInvalidateTime; |
| | | } |
| | | |
| | | public void setSessionInvalidateTime(Integer sessionInvalidateTime) { |
| | | this.sessionInvalidateTime = sessionInvalidateTime; |
| | | } |
| | | |
| | | public Integer getSessionValidationInterval() { |
| | | return sessionValidationInterval; |
| | | } |
| | | |
| | | public void setSessionValidationInterval(Integer sessionValidationInterval) { |
| | | this.sessionValidationInterval = sessionValidationInterval; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.config.web; |
| | | |
| | | import com.stylefeng.guns.config.properties.BeetlProperties; |
| | | import com.stylefeng.guns.core.beetl.BeetlConfiguration; |
| | | import org.beetl.core.resource.ClasspathResourceLoader; |
| | | import org.beetl.ext.spring.BeetlSpringViewResolver; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * web 配置类 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年11月12日 下午5:03:32 |
| | | */ |
| | | @Configuration |
| | | public class BeetlConfig { |
| | | |
| | | @Autowired |
| | | BeetlProperties beetlProperties; |
| | | |
| | | /** |
| | | * beetl的配置 |
| | | */ |
| | | @Bean(initMethod = "init") |
| | | public BeetlConfiguration beetlConfiguration() { |
| | | BeetlConfiguration beetlConfiguration = new BeetlConfiguration(); |
| | | beetlConfiguration.setResourceLoader(new ClasspathResourceLoader(BeetlConfig.class.getClassLoader(), beetlProperties.getPrefix())); |
| | | beetlConfiguration.setConfigProperties(beetlProperties.getProperties()); |
| | | return beetlConfiguration; |
| | | } |
| | | |
| | | /** |
| | | * beetl的视图解析器 |
| | | */ |
| | | @Bean |
| | | public BeetlSpringViewResolver beetlViewResolver() { |
| | | BeetlSpringViewResolver beetlSpringViewResolver = new BeetlSpringViewResolver(); |
| | | beetlSpringViewResolver.setConfig(beetlConfiguration()); |
| | | beetlSpringViewResolver.setContentType("text/html;charset=UTF-8"); |
| | | beetlSpringViewResolver.setOrder(0); |
| | | return beetlSpringViewResolver; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.config.web; |
| | | |
| | | import com.stylefeng.guns.config.properties.GunsProperties; |
| | | import com.stylefeng.guns.core.intercept.GunsUserFilter; |
| | | import com.stylefeng.guns.core.shiro.ShiroDbRealm; |
| | | import org.apache.shiro.cache.CacheManager; |
| | | import org.apache.shiro.cache.ehcache.EhCacheManager; |
| | | import org.apache.shiro.codec.Base64; |
| | | import org.apache.shiro.session.mgt.SessionManager; |
| | | import org.apache.shiro.spring.LifecycleBeanPostProcessor; |
| | | import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor; |
| | | import org.apache.shiro.spring.web.ShiroFilterFactoryBean; |
| | | import org.apache.shiro.web.mgt.CookieRememberMeManager; |
| | | import org.apache.shiro.web.mgt.DefaultWebSecurityManager; |
| | | import org.apache.shiro.web.servlet.Cookie; |
| | | import org.apache.shiro.web.servlet.ShiroHttpSession; |
| | | import org.apache.shiro.web.servlet.SimpleCookie; |
| | | import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; |
| | | import org.apache.shiro.web.session.mgt.ServletContainerSessionManager; |
| | | import org.springframework.beans.factory.config.MethodInvokingFactoryBean; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.cache.ehcache.EhCacheManagerFactoryBean; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import javax.servlet.Filter; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * shiro权限管理的配置 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年11月14日 下午3:03:44 |
| | | */ |
| | | @Configuration |
| | | public class ShiroConfig { |
| | | |
| | | /** |
| | | * 安全管理器 |
| | | */ |
| | | @Bean |
| | | public DefaultWebSecurityManager securityManager(CookieRememberMeManager rememberMeManager, CacheManager cacheShiroManager, SessionManager sessionManager) { |
| | | DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); |
| | | securityManager.setRealm(this.shiroDbRealm()); |
| | | securityManager.setCacheManager(cacheShiroManager); |
| | | securityManager.setRememberMeManager(rememberMeManager); |
| | | securityManager.setSessionManager(sessionManager); |
| | | return securityManager; |
| | | } |
| | | |
| | | /** |
| | | * spring session管理器(多机环境) |
| | | */ |
| | | @Bean |
| | | @ConditionalOnProperty(prefix = "guns", name = "spring-session-open", havingValue = "true") |
| | | public ServletContainerSessionManager servletContainerSessionManager() { |
| | | return new ServletContainerSessionManager(); |
| | | } |
| | | |
| | | /** |
| | | * session管理器(单机环境) |
| | | */ |
| | | @Bean |
| | | @ConditionalOnProperty(prefix = "guns", name = "spring-session-open", havingValue = "false") |
| | | public DefaultWebSessionManager defaultWebSessionManager(CacheManager cacheShiroManager, GunsProperties gunsProperties) { |
| | | DefaultWebSessionManager sessionManager = new DefaultWebSessionManager(); |
| | | sessionManager.setCacheManager(cacheShiroManager); |
| | | sessionManager.setSessionValidationInterval(gunsProperties.getSessionValidationInterval() * 1000); |
| | | sessionManager.setGlobalSessionTimeout(gunsProperties.getSessionInvalidateTime() * 1000); |
| | | sessionManager.setDeleteInvalidSessions(true); |
| | | sessionManager.setSessionValidationSchedulerEnabled(true); |
| | | Cookie cookie = new SimpleCookie(ShiroHttpSession.DEFAULT_SESSION_ID_NAME); |
| | | cookie.setName("shiroCookie"); |
| | | cookie.setHttpOnly(true); |
| | | sessionManager.setSessionIdCookie(cookie); |
| | | return sessionManager; |
| | | } |
| | | |
| | | /** |
| | | * 缓存管理器 使用Ehcache实现 |
| | | */ |
| | | @Bean |
| | | public CacheManager getCacheShiroManager(EhCacheManagerFactoryBean ehcache) { |
| | | EhCacheManager ehCacheManager = new EhCacheManager(); |
| | | ehCacheManager.setCacheManager(ehcache.getObject()); |
| | | return ehCacheManager; |
| | | } |
| | | |
| | | /** |
| | | * 项目自定义的Realm |
| | | */ |
| | | @Bean |
| | | public ShiroDbRealm shiroDbRealm() { |
| | | return new ShiroDbRealm(); |
| | | } |
| | | |
| | | /** |
| | | * rememberMe管理器, cipherKey生成见{@code Base64Test.java} |
| | | */ |
| | | @Bean |
| | | public CookieRememberMeManager rememberMeManager(SimpleCookie rememberMeCookie) { |
| | | CookieRememberMeManager manager = new CookieRememberMeManager(); |
| | | manager.setCipherKey(Base64.decode("Z3VucwAAAAAAAAAAAAAAAA==")); |
| | | manager.setCookie(rememberMeCookie); |
| | | return manager; |
| | | } |
| | | |
| | | /** |
| | | * 记住密码Cookie |
| | | */ |
| | | @Bean |
| | | public SimpleCookie rememberMeCookie() { |
| | | SimpleCookie simpleCookie = new SimpleCookie("rememberMe"); |
| | | simpleCookie.setHttpOnly(true); |
| | | simpleCookie.setMaxAge(7 * 24 * 60 * 60);//7天 |
| | | return simpleCookie; |
| | | } |
| | | |
| | | /** |
| | | * Shiro的过滤器链 |
| | | */ |
| | | @Bean |
| | | public ShiroFilterFactoryBean shiroFilter(DefaultWebSecurityManager securityManager) { |
| | | ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean(); |
| | | shiroFilter.setSecurityManager(securityManager); |
| | | /** |
| | | * 默认的登陆访问url |
| | | */ |
| | | shiroFilter.setLoginUrl("/login"); |
| | | /** |
| | | * 登陆成功后跳转的url |
| | | */ |
| | | shiroFilter.setSuccessUrl("/"); |
| | | /** |
| | | * 没有权限跳转的url |
| | | */ |
| | | shiroFilter.setUnauthorizedUrl("/global/error"); |
| | | |
| | | /** |
| | | * 覆盖默认的user拦截器(默认拦截器解决不了ajax请求 session超时的问题,若有更好的办法请及时反馈作者) |
| | | */ |
| | | HashMap<String, Filter> myFilters = new HashMap<>(); |
| | | myFilters.put("user", new GunsUserFilter()); |
| | | shiroFilter.setFilters(myFilters); |
| | | |
| | | /** |
| | | * 配置shiro拦截器链 |
| | | * |
| | | * anon 不需要认证 |
| | | * authc 需要认证 |
| | | * user 验证通过或RememberMe登录的都可以 |
| | | * |
| | | * 当应用开启了rememberMe时,用户下次访问时可以是一个user,但不会是authc,因为authc是需要重新认证的 |
| | | * |
| | | * 顺序从上到下,优先级依次降低 |
| | | * |
| | | * api开头的接口,走rest api鉴权,不走shiro鉴权 |
| | | * |
| | | */ |
| | | Map<String, String> hashMap = new LinkedHashMap<>(); |
| | | hashMap.put("/swagger-ui.html", "anon"); |
| | | hashMap.put("/swagger-resources/**", "anon"); |
| | | hashMap.put("/v2/**", "anon"); |
| | | hashMap.put("/webjars/**", "anon"); |
| | | hashMap.put("/swagger-resources/configuration/ui/**", "anon"); |
| | | hashMap.put("/swagger-resources/configuration/security/**", "anon"); |
| | | |
| | | hashMap.put("/base/**", "anon"); |
| | | hashMap.put("/api/driver/queryDriverInfo", "anon"); |
| | | hashMap.put("/api/frequentPassengers/queryFrequentPassengersList", "anon"); |
| | | hashMap.put("/api/**", "anon");//api不走shiro验证 |
| | | hashMap.put("/static/**", "anon"); |
| | | hashMap.put("/gunsApi/**", "anon"); |
| | | hashMap.put("/login", "anon"); |
| | | hashMap.put("/global/sessionError", "anon"); |
| | | hashMap.put("/kaptcha", "anon"); |
| | | hashMap.put("/**", "user"); |
| | | |
| | | |
| | | shiroFilter.setFilterChainDefinitionMap(hashMap); |
| | | return shiroFilter; |
| | | } |
| | | |
| | | /** |
| | | * 在方法中 注入 securityManager,进行代理控制 |
| | | */ |
| | | @Bean |
| | | public MethodInvokingFactoryBean methodInvokingFactoryBean(DefaultWebSecurityManager securityManager) { |
| | | MethodInvokingFactoryBean bean = new MethodInvokingFactoryBean(); |
| | | bean.setStaticMethod("org.apache.shiro.SecurityUtils.setSecurityManager"); |
| | | bean.setArguments(new Object[]{securityManager}); |
| | | return bean; |
| | | } |
| | | |
| | | /** |
| | | * Shiro生命周期处理器: |
| | | * 用于在实现了Initializable接口的Shiro bean初始化时调用Initializable接口回调(例如:UserRealm) |
| | | * 在实现了Destroyable接口的Shiro bean销毁时调用 Destroyable接口回调(例如:DefaultSecurityManager) |
| | | */ |
| | | @Bean |
| | | public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() { |
| | | return new LifecycleBeanPostProcessor(); |
| | | } |
| | | |
| | | /** |
| | | * 启用shrio授权注解拦截方式,AOP式方法级权限检查 |
| | | */ |
| | | @Bean |
| | | public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) { |
| | | AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = |
| | | new AuthorizationAttributeSourceAdvisor(); |
| | | authorizationAttributeSourceAdvisor.setSecurityManager(securityManager); |
| | | return authorizationAttributeSourceAdvisor; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.config.web; |
| | | |
| | | import com.alibaba.druid.pool.DruidDataSource; |
| | | import com.alibaba.druid.support.http.StatViewServlet; |
| | | import com.alibaba.druid.support.http.WebStatFilter; |
| | | import com.alibaba.druid.support.spring.stat.BeanTypeAutoProxyCreator; |
| | | import com.alibaba.druid.support.spring.stat.DruidStatInterceptor; |
| | | import com.google.code.kaptcha.impl.DefaultKaptcha; |
| | | import com.google.code.kaptcha.util.Config; |
| | | import com.stylefeng.guns.config.properties.GunsProperties; |
| | | import com.stylefeng.guns.core.intercept.RestApiInteceptor; |
| | | import com.stylefeng.guns.core.listener.ConfigListener; |
| | | import com.stylefeng.guns.core.xss.XssFilter; |
| | | import org.springframework.aop.Advisor; |
| | | import org.springframework.aop.support.DefaultPointcutAdvisor; |
| | | import org.springframework.aop.support.JdkRegexpMethodPointcut; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.web.servlet.FilterRegistrationBean; |
| | | import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; |
| | | import org.springframework.boot.web.servlet.ServletRegistrationBean; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.context.request.RequestContextListener; |
| | | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
| | | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; |
| | | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Properties; |
| | | |
| | | /** |
| | | * web 配置类 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年11月12日 下午5:03:32 |
| | | */ |
| | | @Configuration |
| | | public class WebConfig extends WebMvcConfigurerAdapter { |
| | | |
| | | @Autowired |
| | | private GunsProperties gunsProperties; |
| | | |
| | | /** |
| | | * 增加swagger的支持 |
| | | */ |
| | | @Override |
| | | public void addResourceHandlers(ResourceHandlerRegistry registry) { |
| | | if (gunsProperties.getSwaggerOpen()) { |
| | | registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/"); |
| | | registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 增加对rest api鉴权的spring mvc拦截器 |
| | | */ |
| | | @Override |
| | | public void addInterceptors(InterceptorRegistry registry) { |
| | | registry.addInterceptor(new RestApiInteceptor()).addPathPatterns("/api/**"); |
| | | } |
| | | |
| | | /** |
| | | * druidServlet注册 |
| | | */ |
| | | @Bean |
| | | public ServletRegistrationBean druidServletRegistration() { |
| | | ServletRegistrationBean registration = new ServletRegistrationBean(new StatViewServlet()); |
| | | registration.addUrlMappings("/druid/*"); |
| | | return registration; |
| | | } |
| | | |
| | | /** |
| | | * druid监控 配置URI拦截策略 |
| | | */ |
| | | @Bean |
| | | public FilterRegistrationBean druidStatFilter() { |
| | | FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new WebStatFilter()); |
| | | //添加过滤规则. |
| | | filterRegistrationBean.addUrlPatterns("/*"); |
| | | //添加不需要忽略的格式信息. |
| | | filterRegistrationBean.addInitParameter( |
| | | "exclusions", "/static/*,*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid,/druid/*"); |
| | | //用于session监控页面的用户名显示 需要登录后主动将username注入到session里 |
| | | filterRegistrationBean.addInitParameter("principalSessionName", "username"); |
| | | return filterRegistrationBean; |
| | | } |
| | | |
| | | /** |
| | | * druid数据库连接池监控 |
| | | */ |
| | | @Bean |
| | | public DruidStatInterceptor druidStatInterceptor() { |
| | | return new DruidStatInterceptor(); |
| | | } |
| | | |
| | | @Bean |
| | | public JdkRegexpMethodPointcut druidStatPointcut() { |
| | | JdkRegexpMethodPointcut druidStatPointcut = new JdkRegexpMethodPointcut(); |
| | | String patterns = "com.stylefeng.guns.modular.*.service.*"; |
| | | //可以set多个 |
| | | druidStatPointcut.setPatterns(patterns); |
| | | return druidStatPointcut; |
| | | } |
| | | |
| | | /** |
| | | * druid数据库连接池监控 |
| | | */ |
| | | @Bean |
| | | public BeanTypeAutoProxyCreator beanTypeAutoProxyCreator() { |
| | | BeanTypeAutoProxyCreator beanTypeAutoProxyCreator = new BeanTypeAutoProxyCreator(); |
| | | beanTypeAutoProxyCreator.setTargetBeanType(DruidDataSource.class); |
| | | beanTypeAutoProxyCreator.setInterceptorNames("druidStatInterceptor"); |
| | | return beanTypeAutoProxyCreator; |
| | | } |
| | | |
| | | /** |
| | | * druid 为druidStatPointcut添加拦截 |
| | | * |
| | | * @return |
| | | */ |
| | | @Bean |
| | | public Advisor druidStatAdvisor() { |
| | | return new DefaultPointcutAdvisor(druidStatPointcut(), druidStatInterceptor()); |
| | | } |
| | | |
| | | /** |
| | | * xssFilter注册 |
| | | */ |
| | | @Bean |
| | | public FilterRegistrationBean xssFilterRegistration() { |
| | | XssFilter xssFilter = new XssFilter(); |
| | | xssFilter.setUrlExclusion(Arrays.asList("/notice/update", "/notice/add")); |
| | | FilterRegistrationBean registration = new FilterRegistrationBean(xssFilter); |
| | | registration.addUrlPatterns("/*"); |
| | | return registration; |
| | | } |
| | | |
| | | /** |
| | | * RequestContextListener注册 |
| | | */ |
| | | @Bean |
| | | public ServletListenerRegistrationBean<RequestContextListener> requestContextListenerRegistration() { |
| | | return new ServletListenerRegistrationBean<>(new RequestContextListener()); |
| | | } |
| | | |
| | | /** |
| | | * ConfigListener注册 |
| | | */ |
| | | @Bean |
| | | public ServletListenerRegistrationBean<ConfigListener> configListenerRegistration() { |
| | | return new ServletListenerRegistrationBean<>(new ConfigListener()); |
| | | } |
| | | |
| | | /** |
| | | * 验证码生成相关 |
| | | */ |
| | | @Bean |
| | | public DefaultKaptcha kaptcha() { |
| | | Properties properties = new Properties(); |
| | | properties.put("kaptcha.border", "no"); |
| | | properties.put("kaptcha.border.color", "105,179,90"); |
| | | properties.put("kaptcha.textproducer.font.color", "blue"); |
| | | properties.put("kaptcha.image.width", "125"); |
| | | properties.put("kaptcha.image.height", "45"); |
| | | properties.put("kaptcha.textproducer.font.size", "45"); |
| | | properties.put("kaptcha.session.key", "code"); |
| | | properties.put("kaptcha.textproducer.char.length", "4"); |
| | | properties.put("kaptcha.textproducer.font.names", "宋体,楷体,微软雅黑"); |
| | | Config config = new Config(properties); |
| | | DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); |
| | | defaultKaptcha.setConfig(config); |
| | | return defaultKaptcha; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.aop; |
| | | |
| | | import com.stylefeng.guns.core.common.exception.BizExceptionEnum; |
| | | import com.stylefeng.guns.core.common.exception.InvalidKaptchaException; |
| | | import com.stylefeng.guns.core.base.tips.ErrorTip; |
| | | import com.stylefeng.guns.core.exception.GunsException; |
| | | import com.stylefeng.guns.core.log.LogManager; |
| | | import com.stylefeng.guns.core.log.factory.LogTaskFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import org.apache.shiro.authc.AuthenticationException; |
| | | import org.apache.shiro.authc.CredentialsException; |
| | | import org.apache.shiro.authc.DisabledAccountException; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.ControllerAdvice; |
| | | import org.springframework.web.bind.annotation.ExceptionHandler; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.ResponseStatus; |
| | | |
| | | import java.lang.reflect.UndeclaredThrowableException; |
| | | |
| | | import static com.stylefeng.guns.core.support.HttpKit.getIp; |
| | | import static com.stylefeng.guns.core.support.HttpKit.getRequest; |
| | | |
| | | /** |
| | | * 全局的的异常拦截器(拦截所有的控制器)(带有@RequestMapping注解的方法上都会拦截) |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年11月12日 下午3:19:56 |
| | | */ |
| | | @ControllerAdvice |
| | | @Order(-1) |
| | | public class GlobalExceptionHandler { |
| | | |
| | | private Logger log = LoggerFactory.getLogger(this.getClass()); |
| | | |
| | | /** |
| | | * 拦截业务异常 |
| | | */ |
| | | @ExceptionHandler(GunsException.class) |
| | | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) |
| | | @ResponseBody |
| | | public ErrorTip notFount(GunsException e) { |
| | | LogManager.me().executeLog(LogTaskFactory.exceptionLog(ShiroKit.getUser().getId(), e)); |
| | | getRequest().setAttribute("tip", e.getMessage()); |
| | | log.error("业务异常:", e); |
| | | return new ErrorTip(e.getCode(), e.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * 用户未登录异常 |
| | | */ |
| | | @ExceptionHandler(AuthenticationException.class) |
| | | @ResponseStatus(HttpStatus.UNAUTHORIZED) |
| | | public String unAuth(AuthenticationException e) { |
| | | log.error("用户未登陆:", e); |
| | | return "/login.html"; |
| | | } |
| | | |
| | | /** |
| | | * 账号被冻结异常 |
| | | */ |
| | | @ExceptionHandler(DisabledAccountException.class) |
| | | @ResponseStatus(HttpStatus.UNAUTHORIZED) |
| | | public String accountLocked(DisabledAccountException e, Model model) { |
| | | String username = getRequest().getParameter("username"); |
| | | LogManager.me().executeLog(LogTaskFactory.loginLog(username, "账号被冻结", getIp())); |
| | | model.addAttribute("tips", "账号被冻结"); |
| | | return "/login.html"; |
| | | } |
| | | |
| | | /** |
| | | * 账号密码错误异常 |
| | | */ |
| | | @ExceptionHandler(CredentialsException.class) |
| | | @ResponseStatus(HttpStatus.UNAUTHORIZED) |
| | | public String credentials(CredentialsException e, Model model) { |
| | | String username = getRequest().getParameter("username"); |
| | | LogManager.me().executeLog(LogTaskFactory.loginLog(username, "账号密码错误", getIp())); |
| | | model.addAttribute("tips", "账号密码错误"); |
| | | return "/login.html"; |
| | | } |
| | | |
| | | /** |
| | | * 验证码错误异常 |
| | | */ |
| | | @ExceptionHandler(InvalidKaptchaException.class) |
| | | @ResponseStatus(HttpStatus.BAD_REQUEST) |
| | | public String credentials(InvalidKaptchaException e, Model model) { |
| | | String username = getRequest().getParameter("username"); |
| | | LogManager.me().executeLog(LogTaskFactory.loginLog(username, "验证码错误", getIp())); |
| | | model.addAttribute("tips", "验证码错误"); |
| | | return "/login.html"; |
| | | } |
| | | |
| | | /** |
| | | * 无权访问该资源异常 |
| | | */ |
| | | @ExceptionHandler(UndeclaredThrowableException.class) |
| | | @ResponseStatus(HttpStatus.UNAUTHORIZED) |
| | | @ResponseBody |
| | | public ErrorTip credentials(UndeclaredThrowableException e) { |
| | | getRequest().setAttribute("tip", "权限异常"); |
| | | log.error("权限异常!", e); |
| | | return new ErrorTip(BizExceptionEnum.NO_PERMITION.getCode(), BizExceptionEnum.NO_PERMITION.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * 拦截未知的运行时异常 |
| | | */ |
| | | @ExceptionHandler(RuntimeException.class) |
| | | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) |
| | | @ResponseBody |
| | | public ErrorTip notFount(RuntimeException e) { |
| | | LogManager.me().executeLog(LogTaskFactory.exceptionLog(ShiroKit.getUser().getId(), e)); |
| | | getRequest().setAttribute("tip", "服务器未知运行时异常"); |
| | | log.error("运行时异常:", e); |
| | | return new ErrorTip(BizExceptionEnum.SERVER_ERROR.getCode(), BizExceptionEnum.SERVER_ERROR.getMessage()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.aop; |
| | | |
| | | import com.stylefeng.guns.core.common.annotion.BussinessLog; |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | import com.stylefeng.guns.core.log.LogManager; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.core.log.factory.LogTaskFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.support.HttpKit; |
| | | import com.stylefeng.guns.core.util.Contrast; |
| | | import org.aspectj.lang.ProceedingJoinPoint; |
| | | import org.aspectj.lang.Signature; |
| | | import org.aspectj.lang.annotation.Around; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.annotation.Pointcut; |
| | | import org.aspectj.lang.reflect.MethodSignature; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.lang.reflect.Method; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 日志记录 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年12月6日 下午8:48:30 |
| | | */ |
| | | @Aspect |
| | | @Component |
| | | public class LogAop { |
| | | |
| | | private Logger log = LoggerFactory.getLogger(this.getClass()); |
| | | |
| | | @Pointcut(value = "@annotation(com.stylefeng.guns.core.common.annotion.BussinessLog)") |
| | | public void cutService() { |
| | | } |
| | | |
| | | @Around("cutService()") |
| | | public Object recordSysLog(ProceedingJoinPoint point) throws Throwable { |
| | | |
| | | //先执行业务 |
| | | Object result = point.proceed(); |
| | | |
| | | try { |
| | | handle(point); |
| | | } catch (Exception e) { |
| | | log.error("日志记录出错!", e); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | private void handle(ProceedingJoinPoint point) throws Exception { |
| | | |
| | | //获取拦截的方法名 |
| | | Signature sig = point.getSignature(); |
| | | MethodSignature msig = null; |
| | | if (!(sig instanceof MethodSignature)) { |
| | | throw new IllegalArgumentException("该注解只能用于方法"); |
| | | } |
| | | msig = (MethodSignature) sig; |
| | | Object target = point.getTarget(); |
| | | Method currentMethod = target.getClass().getMethod(msig.getName(), msig.getParameterTypes()); |
| | | String methodName = currentMethod.getName(); |
| | | |
| | | //如果当前用户未登录,不做日志 |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | if (null == user) { |
| | | return; |
| | | } |
| | | |
| | | //获取拦截方法的参数 |
| | | String className = point.getTarget().getClass().getName(); |
| | | Object[] params = point.getArgs(); |
| | | |
| | | //获取操作名称 |
| | | BussinessLog annotation = currentMethod.getAnnotation(BussinessLog.class); |
| | | String bussinessName = annotation.value(); |
| | | String key = annotation.key(); |
| | | Class dictClass = annotation.dict(); |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (Object param : params) { |
| | | sb.append(param); |
| | | sb.append(" & "); |
| | | } |
| | | |
| | | //如果涉及到修改,比对变化 |
| | | String msg; |
| | | if (bussinessName.indexOf("修改") != -1 || bussinessName.indexOf("编辑") != -1) { |
| | | Object obj1 = LogObjectHolder.me().get(); |
| | | Map<String, String> obj2 = HttpKit.getRequestParameters(); |
| | | msg = Contrast.contrastObj(dictClass, key, obj1, obj2); |
| | | } else { |
| | | Map<String, String> parameters = HttpKit.getRequestParameters(); |
| | | AbstractDictMap dictMap = (AbstractDictMap) dictClass.newInstance(); |
| | | msg = Contrast.parseMutiKey(dictMap,key,parameters); |
| | | } |
| | | |
| | | LogManager.me().executeLog(LogTaskFactory.bussinessLog(user.getId(), bussinessName, className, methodName, msg)); |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2017, 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.stylefeng.guns.core.aop; |
| | | |
| | | import com.stylefeng.guns.core.common.annotion.Permission; |
| | | import com.stylefeng.guns.core.shiro.check.PermissionCheckManager; |
| | | import org.aspectj.lang.ProceedingJoinPoint; |
| | | import org.aspectj.lang.annotation.Around; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.annotation.Pointcut; |
| | | import org.aspectj.lang.reflect.MethodSignature; |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.naming.NoPermissionException; |
| | | import java.lang.reflect.Method; |
| | | |
| | | /** |
| | | * AOP 权限自定义检查 |
| | | */ |
| | | @Aspect |
| | | @Component |
| | | @Order(200) |
| | | public class PermissionAop { |
| | | |
| | | @Pointcut(value = "@annotation(com.stylefeng.guns.core.common.annotion.Permission)") |
| | | private void cutPermission() { |
| | | |
| | | } |
| | | |
| | | @Around("cutPermission()") |
| | | public Object doPermission(ProceedingJoinPoint point) throws Throwable { |
| | | MethodSignature ms = (MethodSignature) point.getSignature(); |
| | | Method method = ms.getMethod(); |
| | | Permission permission = method.getAnnotation(Permission.class); |
| | | Object[] permissions = permission.value(); |
| | | if (permissions == null || permissions.length == 0) { |
| | | //检查全体角色 |
| | | boolean result = PermissionCheckManager.checkAll(); |
| | | if (result) { |
| | | return point.proceed(); |
| | | } else { |
| | | throw new NoPermissionException(); |
| | | } |
| | | } else { |
| | | //检查指定角色 |
| | | boolean result = PermissionCheckManager.check(permissions); |
| | | if (result) { |
| | | return point.proceed(); |
| | | } else { |
| | | throw new NoPermissionException(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.beetl; |
| | | |
| | | import com.stylefeng.guns.core.tag.DictSelectorTag; |
| | | import com.stylefeng.guns.core.util.KaptchaUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import org.beetl.core.Context; |
| | | import org.beetl.core.Function; |
| | | import org.beetl.core.Tag; |
| | | import org.beetl.core.TagFactory; |
| | | import org.beetl.ext.spring.BeetlGroupUtilConfiguration; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.core.env.Environment; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | |
| | | /** |
| | | * beetl拓展配置,绑定一些工具类,方便在模板中直接调用 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2018/2/22 21:03 |
| | | */ |
| | | public class BeetlConfiguration extends BeetlGroupUtilConfiguration { |
| | | |
| | | @Autowired |
| | | Environment env; |
| | | |
| | | @Autowired |
| | | ApplicationContext applicationContext; |
| | | |
| | | @Autowired |
| | | DictSelectorTag dictSelectorTag; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void initOther() { |
| | | groupTemplate.registerFunctionPackage("shiro", new ShiroExt()); |
| | | groupTemplate.registerFunctionPackage("tool", new ToolUtil()); |
| | | groupTemplate.registerFunctionPackage("kaptcha", new KaptchaUtil()); |
| | | groupTemplate.registerTagFactory("dictSelector", new TagFactory() { |
| | | @Override |
| | | public Tag createTag() { |
| | | return dictSelectorTag; |
| | | } |
| | | }); |
| | | |
| | | groupTemplate.registerFunction("env", new Function() { |
| | | @Override |
| | | public String call(Object[] paras, Context ctx) { |
| | | String key = (String)paras[0]; |
| | | String value = env.getProperty(key); |
| | | if(value!=null) { |
| | | return getStr(value); |
| | | } |
| | | if(paras.length==2) { |
| | | return (String)paras[1]; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | protected String getStr(String str) { |
| | | try { |
| | | return new String(str.getBytes("iso8859-1"),"UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2017, 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.stylefeng.guns.core.beetl; |
| | | |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.subject.Subject; |
| | | import org.beetl.core.GroupTemplate; |
| | | |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | |
| | | public class ShiroExt { |
| | | private static final String NAMES_DELIMETER = ","; |
| | | |
| | | /** |
| | | * 获取当前 Subject |
| | | * |
| | | * @return Subject |
| | | */ |
| | | protected static Subject getSubject() { |
| | | return SecurityUtils.getSubject(); |
| | | } |
| | | |
| | | /** |
| | | * 获取封装的 ShiroUser |
| | | * |
| | | * @return ShiroUser |
| | | */ |
| | | public ShiroUser getUser() { |
| | | if (isGuest()) { |
| | | return null; |
| | | } else { |
| | | return (ShiroUser) getSubject().getPrincipals().getPrimaryPrincipal(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户是否属于该角色?,使用时与lacksRole 搭配使用 |
| | | * |
| | | * @param roleName 角色名 |
| | | * @return 属于该角色:true,否则false |
| | | */ |
| | | public boolean hasRole(String roleName) { |
| | | return getSubject() != null && roleName != null |
| | | && roleName.length() > 0 && getSubject().hasRole(roleName); |
| | | } |
| | | |
| | | /** |
| | | * 与hasRole标签逻辑相反,当用户不属于该角色时验证通过。 |
| | | * |
| | | * @param roleName 角色名 |
| | | * @return 不属于该角色:true,否则false |
| | | */ |
| | | public boolean lacksRole(String roleName) { |
| | | return !hasRole(roleName); |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户是否属于以下任意一个角色。 |
| | | * |
| | | * @param roleNames 角色列表 |
| | | * @return 属于:true,否则false |
| | | */ |
| | | public boolean hasAnyRoles(String roleNames) { |
| | | boolean hasAnyRole = false; |
| | | Subject subject = getSubject(); |
| | | if (subject != null && roleNames != null && roleNames.length() > 0) { |
| | | for (String role : roleNames.split(NAMES_DELIMETER)) { |
| | | if (subject.hasRole(role.trim())) { |
| | | hasAnyRole = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return hasAnyRole; |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户是否属于以下所有角色。 |
| | | * |
| | | * @param roleNames 角色列表 |
| | | * @return 属于:true,否则false |
| | | */ |
| | | public boolean hasAllRoles(String roleNames) { |
| | | boolean hasAllRole = true; |
| | | Subject subject = getSubject(); |
| | | if (subject != null && roleNames != null && roleNames.length() > 0) { |
| | | for (String role : roleNames.split(NAMES_DELIMETER)) { |
| | | if (!subject.hasRole(role.trim())) { |
| | | hasAllRole = false; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return hasAllRole; |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户是否拥有指定权限,使用时与lacksPermission 搭配使用 |
| | | * |
| | | * @param permission 权限名 |
| | | * @return 拥有权限:true,否则false |
| | | */ |
| | | public boolean hasPermission(String permission) { |
| | | return getSubject() != null && permission != null |
| | | && permission.length() > 0 |
| | | && getSubject().isPermitted(permission); |
| | | } |
| | | |
| | | /** |
| | | * 与hasPermission标签逻辑相反,当前用户没有制定权限时,验证通过。 |
| | | * |
| | | * @param permission 权限名 |
| | | * @return 拥有权限:true,否则false |
| | | */ |
| | | public boolean lacksPermission(String permission) { |
| | | return !hasPermission(permission); |
| | | } |
| | | |
| | | /** |
| | | * 已认证通过的用户。不包含已记住的用户,这是与user标签的区别所在。与notAuthenticated搭配使用 |
| | | * |
| | | * @return 通过身份验证:true,否则false |
| | | */ |
| | | public boolean authenticated() { |
| | | return getSubject() != null && getSubject().isAuthenticated(); |
| | | } |
| | | |
| | | /** |
| | | * 未认证通过用户,与authenticated标签相对应。与guest标签的区别是,该标签包含已记住用户。。 |
| | | * |
| | | * @return 没有通过身份验证:true,否则false |
| | | */ |
| | | public boolean notAuthenticated() { |
| | | return !authenticated(); |
| | | } |
| | | |
| | | /** |
| | | * 认证通过或已记住的用户。与guset搭配使用。 |
| | | * |
| | | * @return 用户:true,否则 false |
| | | */ |
| | | public boolean isUser() { |
| | | return getSubject() != null && getSubject().getPrincipal() != null; |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户是否为“访客”,即未认证(包含未记住)的用户。用user搭配使用 |
| | | * |
| | | * @return 访客:true,否则false |
| | | */ |
| | | public boolean isGuest() { |
| | | return !isUser(); |
| | | } |
| | | |
| | | /** |
| | | * 输出当前用户信息,通常为登录帐号信息。 |
| | | * |
| | | * @return 当前用户信息 |
| | | */ |
| | | public String principal() { |
| | | if (getSubject() != null) { |
| | | Object principal = getSubject().getPrincipal(); |
| | | return principal.toString(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | GroupTemplate gt = new GroupTemplate(); |
| | | gt.registerFunctionPackage("shiro", new ShiroExt()); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.annotion; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.SystemDict; |
| | | |
| | | import java.lang.annotation.*; |
| | | |
| | | /** |
| | | * 标记需要做业务日志的方法 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-03-31 12:46 |
| | | */ |
| | | @Inherited |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Target({ElementType.METHOD}) |
| | | public @interface BussinessLog { |
| | | |
| | | /** |
| | | * 业务的名称,例如:"修改菜单" |
| | | */ |
| | | String value() default ""; |
| | | |
| | | /** |
| | | * 被修改的实体的唯一标识,例如:菜单实体的唯一标识为"id" |
| | | */ |
| | | String key() default "id"; |
| | | |
| | | /** |
| | | * 字典(用于查找key的中文名称和字段的中文名称) |
| | | */ |
| | | Class<? extends AbstractDictMap> dict() default SystemDict.class; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.annotion; |
| | | |
| | | import java.lang.annotation.*; |
| | | |
| | | /** |
| | | * 权限注解 用于检查权限 规定访问权限 |
| | | * |
| | | * @example @Permission({role1,role2}) |
| | | * @example @Permission |
| | | */ |
| | | @Inherited |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Target({ElementType.METHOD}) |
| | | public @interface Permission { |
| | | |
| | | /** |
| | | * <p>角色英文名称</p> |
| | | * <p>使用注解时加上这个值表示限制只有某个角色的才可以访问对应的资源</p> |
| | | * <p>常用在某些资源限制只有超级管理员角色才可访问</p> |
| | | */ |
| | | String[] value() default {}; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant; |
| | | |
| | | /** |
| | | * 系统常量 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017年2月12日 下午9:42:53 |
| | | */ |
| | | public interface Const { |
| | | |
| | | /** |
| | | * 系统默认的管理员密码 |
| | | */ |
| | | String DEFAULT_PWD = "111111"; |
| | | |
| | | /** |
| | | * 管理员角色的名字 |
| | | */ |
| | | String ADMIN_NAME = "administrator"; |
| | | |
| | | /** |
| | | * 管理员id |
| | | */ |
| | | Integer ADMIN_ID = 1; |
| | | |
| | | /** |
| | | * 超级管理员角色id |
| | | */ |
| | | Integer ADMIN_ROLE_ID = 1; |
| | | |
| | | /** |
| | | * 接口文档的菜单名 |
| | | */ |
| | | String API_MENU_NAME = "接口文档"; |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant; |
| | | |
| | | /** |
| | | * |
| | | * 多数据源的枚举 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017年3月5日 上午10:15:02 |
| | | */ |
| | | public interface DatasourceEnum { |
| | | |
| | | String DATA_SOURCE_GUNS = "dataSourceGuns"; //guns数据源 |
| | | |
| | | String DATA_SOURCE_BIZ = "dataSourceBiz"; //其他业务的数据源 |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant; |
| | | |
| | | /** |
| | | * jwt相关配置 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-08-23 9:23 |
| | | */ |
| | | public interface JwtConstants { |
| | | |
| | | String AUTH_HEADER = "Authorization"; |
| | | |
| | | String SECRET = "defaultSecret"; |
| | | |
| | | Long EXPIRATION = 604800L; |
| | | |
| | | String AUTH_PATH = "/gunsApi/auth"; |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.cache; |
| | | |
| | | /** |
| | | * 所有缓存名称的集合 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-04-24 21:56 |
| | | */ |
| | | public interface Cache { |
| | | |
| | | /** |
| | | * 常量缓存 |
| | | */ |
| | | String CONSTANT = "CONSTANT"; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.cache; |
| | | |
| | | /** |
| | | * 缓存标识前缀集合,常用在ConstantFactory类中 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-04-25 9:37 |
| | | */ |
| | | public interface CacheKey { |
| | | |
| | | /** |
| | | * 角色名称(多个) |
| | | */ |
| | | String ROLES_NAME = "roles_name_"; |
| | | |
| | | /** |
| | | * 角色名称(单个) |
| | | */ |
| | | String SINGLE_ROLE_NAME = "single_role_name_"; |
| | | |
| | | /** |
| | | * 角色英文名称 |
| | | */ |
| | | String SINGLE_ROLE_TIP = "single_role_tip_"; |
| | | |
| | | /** |
| | | * 部门名称 |
| | | */ |
| | | String DEPT_NAME = "dept_name_"; |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 用于删除业务的字典 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class DeleteDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("roleId","角色名称"); |
| | | put("deptId", "部门名称"); |
| | | put("menuId", "菜单名称"); |
| | | put("dictId", "字典名称"); |
| | | put("noticeId", "标题"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | putFieldWrapperMethodName("roleId","getCacheObject"); |
| | | putFieldWrapperMethodName("deptId","getCacheObject"); |
| | | putFieldWrapperMethodName("menuId","getCacheObject"); |
| | | putFieldWrapperMethodName("dictId","getCacheObject"); |
| | | putFieldWrapperMethodName("noticeId","getCacheObject"); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 部门的映射 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class DeptDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("deptId", "部门名称"); |
| | | put("num", "部门排序"); |
| | | put("pid", "上级名称"); |
| | | put("simplename", "部门简称"); |
| | | put("fullname", "部门全称"); |
| | | put("tips", "备注"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | putFieldWrapperMethodName("deptId", "getDeptName"); |
| | | putFieldWrapperMethodName("pid", "getDeptName"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 字典map |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:43 |
| | | */ |
| | | public class DictMap extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("dictId","字典名称"); |
| | | put("dictName","字典名称"); |
| | | put("dictValues","字典内容"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 日志的字典 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class LogDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("tips","备注"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 菜单的字典 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class MenuDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("menuId","菜单id"); |
| | | put("id","菜单id"); |
| | | put("code","菜单编号"); |
| | | put("pcode","菜单父编号"); |
| | | put("name","菜单名称"); |
| | | put("icon","菜单图标"); |
| | | put("url","url地址"); |
| | | put("num","菜单排序号"); |
| | | put("levels","菜单层级"); |
| | | put("tips","备注"); |
| | | put("status","菜单状态"); |
| | | put("isopen","是否打开"); |
| | | put("",""); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 通知的映射 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class NoticeMap extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("title", "标题"); |
| | | put("content", "内容"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 角色的字典 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class RoleDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("roleId","角色名称"); |
| | | put("num","角色排序"); |
| | | put("pid","角色的父级"); |
| | | put("name","角色名称"); |
| | | put("deptid","部门名称"); |
| | | put("tips","备注"); |
| | | put("ids","资源名称"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | putFieldWrapperMethodName("pid","getSingleRoleName"); |
| | | putFieldWrapperMethodName("deptid","getDeptName"); |
| | | putFieldWrapperMethodName("roleId","getSingleRoleName"); |
| | | putFieldWrapperMethodName("ids","getMenuNames"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | |
| | | /** |
| | | * 用户的字典 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:01 |
| | | */ |
| | | public class UserDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | put("userId","账号"); |
| | | put("avatar","头像"); |
| | | put("account","账号"); |
| | | put("name","名字"); |
| | | put("birthday","生日"); |
| | | put("sex","性别"); |
| | | put("email","电子邮件"); |
| | | put("phone","电话"); |
| | | put("roleid","角色名称"); |
| | | put("deptid","部门名称"); |
| | | put("roleIds","角色名称集合"); |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | putFieldWrapperMethodName("sex","getSexName"); |
| | | putFieldWrapperMethodName("deptid","getDeptName"); |
| | | putFieldWrapperMethodName("roleid","getSingleRoleName"); |
| | | putFieldWrapperMethodName("userId","getUserAccountById"); |
| | | putFieldWrapperMethodName("roleIds","getRoleName"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap.base; |
| | | |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | | * 字典映射抽象类 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 14:58 |
| | | */ |
| | | public abstract class AbstractDictMap { |
| | | |
| | | protected HashMap<String, String> dictory = new HashMap<>(); |
| | | protected HashMap<String, String> fieldWarpperDictory = new HashMap<>(); |
| | | |
| | | public AbstractDictMap(){ |
| | | put("id","主键id"); |
| | | init(); |
| | | initBeWrapped(); |
| | | } |
| | | |
| | | /** |
| | | * 初始化字段英文名称和中文名称对应的字典 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/9 19:39 |
| | | */ |
| | | public abstract void init(); |
| | | |
| | | /** |
| | | * 初始化需要被包装的字段(例如:性别为1:男,2:女,需要被包装为汉字) |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/9 19:35 |
| | | */ |
| | | protected abstract void initBeWrapped(); |
| | | |
| | | public String get(String key) { |
| | | return this.dictory.get(key); |
| | | } |
| | | |
| | | public void put(String key, String value) { |
| | | this.dictory.put(key, value); |
| | | } |
| | | |
| | | public String getFieldWarpperMethodName(String key){ |
| | | return this.fieldWarpperDictory.get(key); |
| | | } |
| | | |
| | | public void putFieldWrapperMethodName(String key,String methodName){ |
| | | this.fieldWarpperDictory.put(key,methodName); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap.base; |
| | | |
| | | /** |
| | | * 系统相关的字典 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:48 |
| | | */ |
| | | public class SystemDict extends AbstractDictMap { |
| | | |
| | | @Override |
| | | public void init() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void initBeWrapped() { |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.dictmap.factory; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.factory.ConstantFactory; |
| | | import com.stylefeng.guns.core.common.constant.factory.IConstantFactory; |
| | | import com.stylefeng.guns.core.common.exception.BizExceptionEnum; |
| | | import com.stylefeng.guns.core.exception.GunsException; |
| | | |
| | | import java.lang.reflect.Method; |
| | | |
| | | /** |
| | | * 字典字段的包装器(从ConstantFactory中获取包装值) |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:12 |
| | | */ |
| | | public class DictFieldWarpperFactory { |
| | | |
| | | public static Object createFieldWarpper(Object parameter, String methodName) { |
| | | IConstantFactory constantFactory = ConstantFactory.me(); |
| | | try { |
| | | Method method = IConstantFactory.class.getMethod(methodName, parameter.getClass()); |
| | | return method.invoke(constantFactory, parameter); |
| | | } catch (Exception e) { |
| | | try { |
| | | Method method = IConstantFactory.class.getMethod(methodName, Integer.class); |
| | | return method.invoke(constantFactory, Integer.parseInt(parameter.toString())); |
| | | } catch (Exception e1) { |
| | | throw new GunsException(BizExceptionEnum.ERROR_WRAPPER_FIELD); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.factory; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.stylefeng.guns.core.common.constant.cache.Cache; |
| | | import com.stylefeng.guns.core.common.constant.cache.CacheKey; |
| | | import com.stylefeng.guns.core.common.constant.state.ManagerStatus; |
| | | import com.stylefeng.guns.core.common.constant.state.MenuStatus; |
| | | import com.stylefeng.guns.modular.system.dao.*; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.core.support.StrKit; |
| | | import com.stylefeng.guns.core.util.Convert; |
| | | import com.stylefeng.guns.core.util.SpringContextHolder; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 常量的生产工厂 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017年2月13日 下午10:55:21 |
| | | */ |
| | | @Component |
| | | @DependsOn("springContextHolder") |
| | | public class ConstantFactory implements IConstantFactory { |
| | | |
| | | private RoleMapper roleMapper = SpringContextHolder.getBean(RoleMapper.class); |
| | | private DeptMapper deptMapper = SpringContextHolder.getBean(DeptMapper.class); |
| | | private DictMapper dictMapper = SpringContextHolder.getBean(DictMapper.class); |
| | | private UserMapper userMapper = SpringContextHolder.getBean(UserMapper.class); |
| | | private MenuMapper menuMapper = SpringContextHolder.getBean(MenuMapper.class); |
| | | private NoticeMapper noticeMapper = SpringContextHolder.getBean(NoticeMapper.class); |
| | | |
| | | public static IConstantFactory me() { |
| | | return SpringContextHolder.getBean("constantFactory"); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户id获取用户名称 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/9 23:41 |
| | | */ |
| | | @Override |
| | | public String getUserNameById(Integer userId) { |
| | | User user = userMapper.selectById(userId); |
| | | if (user != null) { |
| | | return user.getName(); |
| | | } else { |
| | | return "--"; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据用户id获取用户账号 |
| | | * |
| | | * @author stylefeng |
| | | * @date 2017年5月16日21:55:371 |
| | | */ |
| | | @Override |
| | | public String getUserAccountById(Integer userId) { |
| | | User user = userMapper.selectById(userId); |
| | | if (user != null) { |
| | | return user.getAccount(); |
| | | } else { |
| | | return "--"; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 通过角色ids获取角色名称 |
| | | */ |
| | | @Override |
| | | @Cacheable(value = Cache.CONSTANT, key = "'" + CacheKey.ROLES_NAME + "'+#roleIds") |
| | | public String getRoleName(String roleIds) { |
| | | Integer[] roles = Convert.toIntArray(roleIds); |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (int role : roles) { |
| | | Role roleObj = roleMapper.selectById(role); |
| | | if (ToolUtil.isNotEmpty(roleObj) && ToolUtil.isNotEmpty(roleObj.getName())) { |
| | | sb.append(roleObj.getName()).append(","); |
| | | } |
| | | } |
| | | return StrKit.removeSuffix(sb.toString(), ","); |
| | | } |
| | | |
| | | /** |
| | | * 通过角色id获取角色名称 |
| | | */ |
| | | @Override |
| | | @Cacheable(value = Cache.CONSTANT, key = "'" + CacheKey.SINGLE_ROLE_NAME + "'+#roleId") |
| | | public String getSingleRoleName(Integer roleId) { |
| | | if (0 == roleId) { |
| | | return "--"; |
| | | } |
| | | Role roleObj = roleMapper.selectById(roleId); |
| | | if (ToolUtil.isNotEmpty(roleObj) && ToolUtil.isNotEmpty(roleObj.getName())) { |
| | | return roleObj.getName(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 通过角色id获取角色英文名称 |
| | | */ |
| | | @Override |
| | | @Cacheable(value = Cache.CONSTANT, key = "'" + CacheKey.SINGLE_ROLE_TIP + "'+#roleId") |
| | | public String getSingleRoleTip(Integer roleId) { |
| | | if (0 == roleId) { |
| | | return "--"; |
| | | } |
| | | Role roleObj = roleMapper.selectById(roleId); |
| | | if (ToolUtil.isNotEmpty(roleObj) && ToolUtil.isNotEmpty(roleObj.getName())) { |
| | | return roleObj.getTips(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取部门名称 |
| | | */ |
| | | @Override |
| | | @Cacheable(value = Cache.CONSTANT, key = "'" + CacheKey.DEPT_NAME + "'+#deptId") |
| | | public String getDeptName(Integer deptId) { |
| | | Dept dept = deptMapper.selectById(deptId); |
| | | if (ToolUtil.isNotEmpty(dept) && ToolUtil.isNotEmpty(dept.getFullname())) { |
| | | return dept.getFullname(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取菜单的名称们(多个) |
| | | */ |
| | | @Override |
| | | public String getMenuNames(String menuIds) { |
| | | Integer[] menus = Convert.toIntArray(menuIds); |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (int menu : menus) { |
| | | Menu menuObj = menuMapper.selectById(menu); |
| | | if (ToolUtil.isNotEmpty(menuObj) && ToolUtil.isNotEmpty(menuObj.getName())) { |
| | | sb.append(menuObj.getName()).append(","); |
| | | } |
| | | } |
| | | return StrKit.removeSuffix(sb.toString(), ","); |
| | | } |
| | | |
| | | /** |
| | | * 获取菜单名称 |
| | | */ |
| | | @Override |
| | | public String getMenuName(Long menuId) { |
| | | if (ToolUtil.isEmpty(menuId)) { |
| | | return ""; |
| | | } else { |
| | | Menu menu = menuMapper.selectById(menuId); |
| | | if (menu == null) { |
| | | return ""; |
| | | } else { |
| | | return menu.getName(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取菜单名称通过编号 |
| | | */ |
| | | @Override |
| | | public String getMenuNameByCode(String code) { |
| | | if (ToolUtil.isEmpty(code)) { |
| | | return ""; |
| | | } else { |
| | | Menu param = new Menu(); |
| | | param.setCode(code); |
| | | Menu menu = menuMapper.selectOne(param); |
| | | if (menu == null) { |
| | | return ""; |
| | | } else { |
| | | return menu.getName(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取字典名称 |
| | | */ |
| | | @Override |
| | | public String getDictName(Integer dictId) { |
| | | if (ToolUtil.isEmpty(dictId)) { |
| | | return ""; |
| | | } else { |
| | | Dict dict = dictMapper.selectById(dictId); |
| | | if (dict == null) { |
| | | return ""; |
| | | } else { |
| | | return dict.getName(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取通知标题 |
| | | */ |
| | | @Override |
| | | public String getNoticeTitle(Integer dictId) { |
| | | if (ToolUtil.isEmpty(dictId)) { |
| | | return ""; |
| | | } else { |
| | | Notice notice = noticeMapper.selectById(dictId); |
| | | if (notice == null) { |
| | | return ""; |
| | | } else { |
| | | return notice.getTitle(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据字典名称和字典中的值获取对应的名称 |
| | | */ |
| | | @Override |
| | | public String getDictsByName(String name, Integer val) { |
| | | Dict temp = new Dict(); |
| | | temp.setName(name); |
| | | Dict dict = dictMapper.selectOne(temp); |
| | | if (dict == null) { |
| | | return ""; |
| | | } else { |
| | | Wrapper<Dict> wrapper = new EntityWrapper<>(); |
| | | wrapper = wrapper.eq("pid", dict.getId()); |
| | | List<Dict> dicts = dictMapper.selectList(wrapper); |
| | | for (Dict item : dicts) { |
| | | if (item.getNum() != null && item.getNum().equals(val)) { |
| | | return item.getName(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取性别名称 |
| | | */ |
| | | @Override |
| | | public String getSexName(Integer sex) { |
| | | return getDictsByName("性别", sex); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户登录状态 |
| | | */ |
| | | @Override |
| | | public String getStatusName(Integer status) { |
| | | return ManagerStatus.valueOf(status); |
| | | } |
| | | |
| | | /** |
| | | * 获取菜单状态 |
| | | */ |
| | | @Override |
| | | public String getMenuStatusName(Integer status) { |
| | | return MenuStatus.valueOf(status); |
| | | } |
| | | |
| | | /** |
| | | * 查询字典 |
| | | */ |
| | | @Override |
| | | public List<Dict> findInDict(Integer id) { |
| | | if (ToolUtil.isEmpty(id)) { |
| | | return null; |
| | | } else { |
| | | EntityWrapper<Dict> wrapper = new EntityWrapper<>(); |
| | | List<Dict> dicts = dictMapper.selectList(wrapper.eq("pid", id)); |
| | | if (dicts == null || dicts.size() == 0) { |
| | | return null; |
| | | } else { |
| | | return dicts; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取被缓存的对象(用户删除业务) |
| | | */ |
| | | @Override |
| | | public String getCacheObject(String para) { |
| | | return LogObjectHolder.me().get().toString(); |
| | | } |
| | | |
| | | /** |
| | | * 获取子部门id |
| | | */ |
| | | @Override |
| | | public List<Integer> getSubDeptId(Integer deptid) { |
| | | Wrapper<Dept> wrapper = new EntityWrapper<>(); |
| | | wrapper = wrapper.like("pids", "%[" + deptid + "]%"); |
| | | List<Dept> depts = this.deptMapper.selectList(wrapper); |
| | | |
| | | ArrayList<Integer> deptids = new ArrayList<>(); |
| | | |
| | | if(depts != null && depts.size() > 0){ |
| | | for (Dept dept : depts) { |
| | | deptids.add(dept.getId()); |
| | | } |
| | | } |
| | | |
| | | return deptids; |
| | | } |
| | | |
| | | /** |
| | | * 获取所有父部门id |
| | | */ |
| | | @Override |
| | | public List<Integer> getParentDeptIds(Integer deptid) { |
| | | Dept dept = deptMapper.selectById(deptid); |
| | | String pids = dept.getPids(); |
| | | String[] split = pids.split(","); |
| | | ArrayList<Integer> parentDeptIds = new ArrayList<>(); |
| | | for (String s : split) { |
| | | parentDeptIds.add(Integer.valueOf(StrKit.removeSuffix(StrKit.removePrefix(s, "["), "]"))); |
| | | } |
| | | return parentDeptIds; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.factory; |
| | | |
| | | import com.stylefeng.guns.modular.system.model.Dict; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 常量生产工厂的接口 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-06-14 21:12 |
| | | */ |
| | | public interface IConstantFactory { |
| | | |
| | | /** |
| | | * 根据用户id获取用户名称 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/9 23:41 |
| | | */ |
| | | String getUserNameById(Integer userId); |
| | | |
| | | /** |
| | | * 根据用户id获取用户账号 |
| | | * |
| | | * @author stylefeng |
| | | * @date 2017年5月16日21:55:371 |
| | | */ |
| | | String getUserAccountById(Integer userId); |
| | | |
| | | /** |
| | | * 通过角色ids获取角色名称 |
| | | */ |
| | | String getRoleName(String roleIds); |
| | | |
| | | /** |
| | | * 通过角色id获取角色名称 |
| | | */ |
| | | String getSingleRoleName(Integer roleId); |
| | | |
| | | /** |
| | | * 通过角色id获取角色英文名称 |
| | | */ |
| | | String getSingleRoleTip(Integer roleId); |
| | | |
| | | /** |
| | | * 获取部门名称 |
| | | */ |
| | | String getDeptName(Integer deptId); |
| | | |
| | | /** |
| | | * 获取菜单的名称们(多个) |
| | | */ |
| | | String getMenuNames(String menuIds); |
| | | |
| | | /** |
| | | * 获取菜单名称 |
| | | */ |
| | | String getMenuName(Long menuId); |
| | | |
| | | /** |
| | | * 获取菜单名称通过编号 |
| | | */ |
| | | String getMenuNameByCode(String code); |
| | | |
| | | /** |
| | | * 获取字典名称 |
| | | */ |
| | | String getDictName(Integer dictId); |
| | | |
| | | /** |
| | | * 获取通知标题 |
| | | */ |
| | | String getNoticeTitle(Integer dictId); |
| | | |
| | | /** |
| | | * 根据字典名称和字典中的值获取对应的名称 |
| | | */ |
| | | String getDictsByName(String name, Integer val); |
| | | |
| | | /** |
| | | * 获取性别名称 |
| | | */ |
| | | String getSexName(Integer sex); |
| | | |
| | | /** |
| | | * 获取用户登录状态 |
| | | */ |
| | | String getStatusName(Integer status); |
| | | |
| | | /** |
| | | * 获取菜单状态 |
| | | */ |
| | | String getMenuStatusName(Integer status); |
| | | |
| | | /** |
| | | * 查询字典 |
| | | */ |
| | | List<Dict> findInDict(Integer id); |
| | | |
| | | /** |
| | | * 获取被缓存的对象(用户删除业务) |
| | | */ |
| | | String getCacheObject(String para); |
| | | |
| | | /** |
| | | * 获取子部门id |
| | | */ |
| | | List<Integer> getSubDeptId(Integer deptid); |
| | | |
| | | /** |
| | | * 获取所有父部门id |
| | | */ |
| | | List<Integer> getParentDeptIds(Integer deptid); |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.factory; |
| | | |
| | | import com.stylefeng.guns.core.support.StrKit; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 组合字符串生产者 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-04-27 16:42 |
| | | */ |
| | | public class MutiStrFactory { |
| | | |
| | | /** |
| | | * 每个条目之间的分隔符 |
| | | */ |
| | | public static final String ITEM_SPLIT = ";"; |
| | | |
| | | /** |
| | | * 属性之间的分隔符 |
| | | */ |
| | | public static final String ATTR_SPLIT = ":"; |
| | | |
| | | /** |
| | | * 拼接字符串的id |
| | | */ |
| | | public static final String MUTI_STR_ID = "ID"; |
| | | |
| | | /** |
| | | * 拼接字符串的CODE |
| | | */ |
| | | public static final String MUTI_STR_CODE = "CODE"; |
| | | |
| | | /** |
| | | * 拼接字符串的NAME |
| | | */ |
| | | public static final String MUTI_STR_NAME = "NAME"; |
| | | |
| | | /** |
| | | * 拼接字符串的NUM |
| | | */ |
| | | public static final String MUTI_STR_NUM = "NUM"; |
| | | |
| | | /** |
| | | * 解析一个组合字符串(例如: "1:启用;2:禁用;3:冻结" 这样的字符串) |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017/4/27 16:44 |
| | | */ |
| | | public static List<Map<String,String>> parseKeyValue(String mutiString){ |
| | | if(ToolUtil.isEmpty(mutiString)){ |
| | | return new ArrayList<>(); |
| | | }else{ |
| | | ArrayList<Map<String,String>> results = new ArrayList<>(); |
| | | String[] items = StrKit.split(StrKit.removeSuffix(mutiString, ITEM_SPLIT), ITEM_SPLIT); |
| | | for (String item : items) { |
| | | String[] attrs = item.split(ATTR_SPLIT); |
| | | HashMap<String, String> itemMap = new HashMap<>(); |
| | | itemMap.put(MUTI_STR_CODE,attrs[0]); |
| | | itemMap.put(MUTI_STR_NAME,attrs[1]); |
| | | itemMap.put(MUTI_STR_NUM,attrs[2]); |
| | | results.add(itemMap); |
| | | } |
| | | return results; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 解析id:key:value这样类型的字符串 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017/4/28 11:06 |
| | | */ |
| | | public static List<Map<String,String>> parseIdKeyValue(String mutiString){ |
| | | if(ToolUtil.isEmpty(mutiString)){ |
| | | return new ArrayList<>(); |
| | | }else{ |
| | | ArrayList<Map<String,String>> results = new ArrayList<>(); |
| | | String[] items = StrKit.split(StrKit.removeSuffix(mutiString, ITEM_SPLIT), ITEM_SPLIT); |
| | | for (String item : items) { |
| | | String[] attrs = item.split(ATTR_SPLIT); |
| | | HashMap<String, String> itemMap = new HashMap<>(); |
| | | itemMap.put(MUTI_STR_CODE,attrs[0]); |
| | | itemMap.put(MUTI_STR_NAME,attrs[1]); |
| | | itemMap.put(MUTI_STR_NUM,attrs[2]); |
| | | results.add(itemMap); |
| | | } |
| | | return results; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.factory; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.common.constant.state.Order; |
| | | import com.stylefeng.guns.core.support.HttpKit; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | /** |
| | | * BootStrap Table默认的分页参数创建 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-04-05 22:25 |
| | | */ |
| | | public class PageFactory<T> { |
| | | |
| | | public Page<T> defaultPage() { |
| | | HttpServletRequest request = HttpKit.getRequest(); |
| | | int limit = Integer.valueOf(request.getParameter("limit")); //每页多少条数据 |
| | | int offset = Integer.valueOf(request.getParameter("offset")); //每页的偏移量(本页当前有多少条) |
| | | String sort = request.getParameter("sort"); //排序字段名称 |
| | | String order = request.getParameter("order"); //asc或desc(升序或降序) |
| | | if (ToolUtil.isEmpty(sort)) { |
| | | Page<T> page = new Page<>((offset / limit + 1), limit); |
| | | page.setOpenSort(false); |
| | | return page; |
| | | } else { |
| | | Page<T> page = new Page<>((offset / limit + 1), limit, sort); |
| | | if (Order.ASC.getDes().equals(order)) { |
| | | page.setAsc(true); |
| | | } else { |
| | | page.setAsc(false); |
| | | } |
| | | return page; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.state; |
| | | |
| | | /** |
| | | * 业务日志类型 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年1月22日 下午12:14:59 |
| | | */ |
| | | public enum BizLogType { |
| | | |
| | | ALL(0, null),//全部日志 |
| | | BUSSINESS(1, "业务日志"), |
| | | EXCEPTION(2, "异常日志"); |
| | | |
| | | Integer val; |
| | | String message; |
| | | |
| | | BizLogType(Integer val, String message) { |
| | | this.val = val; |
| | | this.message = message; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | public Integer getVal() { |
| | | return val; |
| | | } |
| | | |
| | | public void setVal(Integer val) { |
| | | this.val = val; |
| | | } |
| | | |
| | | public static String valueOf(Integer value) { |
| | | if (value == null) { |
| | | return null; |
| | | } else { |
| | | for (BizLogType bizLogType : BizLogType.values()) { |
| | | if (bizLogType.getVal().equals(value)) { |
| | | return bizLogType.getMessage(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.state; |
| | | |
| | | /** |
| | | * 是否是菜单的枚举 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017年6月1日22:50:11 |
| | | */ |
| | | public enum ExpenseState { |
| | | |
| | | SUBMITING(1, "待提交"), |
| | | CHECKING(2, "待审核"), |
| | | PASS(3, "审核通过"), |
| | | UN_PASS(4, "未通过"); |
| | | |
| | | int code; |
| | | String message; |
| | | |
| | | ExpenseState(int code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | public static String valueOf(Integer status) { |
| | | if (status == null) { |
| | | return ""; |
| | | } else { |
| | | for (ExpenseState s : ExpenseState.values()) { |
| | | if (s.getCode() == status) { |
| | | return s.getMessage(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.state; |
| | | |
| | | /** |
| | | * 业务是否成功的日志记录 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年1月22日 下午12:14:59 |
| | | */ |
| | | public enum LogSucceed { |
| | | |
| | | SUCCESS("成功"), |
| | | FAIL("失败"); |
| | | |
| | | String message; |
| | | |
| | | LogSucceed(String message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.state; |
| | | |
| | | /** |
| | | * 日志类型 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年1月22日 下午12:14:59 |
| | | */ |
| | | public enum LogType { |
| | | |
| | | LOGIN("登录日志"), |
| | | LOGIN_FAIL("登录失败日志"), |
| | | EXIT("退出日志"), |
| | | EXCEPTION("异常日志"), |
| | | BUSSINESS("业务日志"); |
| | | |
| | | String message; |
| | | |
| | | LogType(String message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.state; |
| | | |
| | | /** |
| | | * 管理员的状态 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年1月10日 下午9:54:13 |
| | | */ |
| | | public enum ManagerStatus { |
| | | |
| | | OK(1, "启用"), FREEZED(2, "冻结"), DELETED(3, "被删除"); |
| | | |
| | | int code; |
| | | String message; |
| | | |
| | | ManagerStatus(int code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | public static String valueOf(Integer value) { |
| | | if (value == null) { |
| | | return ""; |
| | | } else { |
| | | for (ManagerStatus ms : ManagerStatus.values()) { |
| | | if (ms.getCode() == value) { |
| | | return ms.getMessage(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.state; |
| | | |
| | | /** |
| | | * 菜单是否打开的状态 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年4月8日10:12:15 |
| | | */ |
| | | public enum MenuOpenStatus { |
| | | |
| | | OPEN(1, "打开"), |
| | | CLOSE(0, "关闭"); |
| | | |
| | | int code; |
| | | String message; |
| | | |
| | | MenuOpenStatus(int code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | public static String valueOf(Integer status) { |
| | | if (status == null) { |
| | | return ""; |
| | | } else { |
| | | for (MenuOpenStatus s : MenuOpenStatus.values()) { |
| | | if (s.getCode() == status) { |
| | | return s.getMessage(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.state; |
| | | |
| | | /** |
| | | * 菜单的状态 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年1月22日 下午12:14:59 |
| | | */ |
| | | public enum MenuStatus { |
| | | |
| | | ENABLE(1, "启用"), |
| | | DISABLE(0, "禁用"); |
| | | |
| | | int code; |
| | | String message; |
| | | |
| | | MenuStatus(int code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | public static String valueOf(Integer status) { |
| | | if (status == null) { |
| | | return ""; |
| | | } else { |
| | | for (MenuStatus s : MenuStatus.values()) { |
| | | if (s.getCode() == status) { |
| | | return s.getMessage(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.constant.state; |
| | | |
| | | /** |
| | | * 数据库排序 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年5月31日20:48:41 |
| | | */ |
| | | public enum Order { |
| | | |
| | | ASC("asc"), DESC("desc"); |
| | | |
| | | private String des; |
| | | |
| | | Order(String des) { |
| | | this.des = des; |
| | | } |
| | | |
| | | public String getDes() { |
| | | return des; |
| | | } |
| | | |
| | | public void setDes(String des) { |
| | | this.des = des; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.exception; |
| | | |
| | | import com.stylefeng.guns.core.exception.ServiceExceptionEnum; |
| | | |
| | | /** |
| | | * @author fengshuonan |
| | | * @Description 所有业务异常的枚举 |
| | | * @date 2016年11月12日 下午5:04:51 |
| | | */ |
| | | public enum BizExceptionEnum implements ServiceExceptionEnum { |
| | | |
| | | /** |
| | | * 字典 |
| | | */ |
| | | DICT_EXISTED(400, "字典已经存在"), |
| | | ERROR_CREATE_DICT(500, "创建字典失败"), |
| | | ERROR_WRAPPER_FIELD(500, "包装字典属性失败"), |
| | | ERROR_CODE_EMPTY(500, "字典类型不能为空"), |
| | | |
| | | /** |
| | | * 文件上传 |
| | | */ |
| | | FILE_READING_ERROR(400, "FILE_READING_ERROR!"), |
| | | FILE_NOT_FOUND(400, "FILE_NOT_FOUND!"), |
| | | UPLOAD_ERROR(500, "上传图片出错"), |
| | | |
| | | /** |
| | | * 权限和数据问题 |
| | | */ |
| | | DB_RESOURCE_NULL(400, "数据库中没有该资源"), |
| | | NO_PERMITION(405, "权限异常"), |
| | | REQUEST_INVALIDATE(400, "请求数据格式不正确"), |
| | | INVALID_KAPTCHA(400, "验证码不正确"), |
| | | CANT_DELETE_ADMIN(600, "不能删除超级管理员"), |
| | | CANT_FREEZE_ADMIN(600, "不能冻结超级管理员"), |
| | | CANT_CHANGE_ADMIN(600, "不能修改超级管理员角色"), |
| | | |
| | | /** |
| | | * 账户问题 |
| | | */ |
| | | USER_ALREADY_REG(401, "该用户已经注册"), |
| | | NO_THIS_USER(400, "没有此用户"), |
| | | USER_NOT_EXISTED(400, "没有此用户"), |
| | | ACCOUNT_FREEZED(401, "账号被冻结"), |
| | | OLD_PWD_NOT_RIGHT(402, "原密码不正确"), |
| | | TWO_PWD_NOT_MATCH(405, "两次输入密码不一致"), |
| | | |
| | | /** |
| | | * 错误的请求 |
| | | */ |
| | | MENU_PCODE_COINCIDENCE(400, "菜单编号和副编号不能一致"), |
| | | EXISTED_THE_MENU(400, "菜单编号重复,不能添加"), |
| | | DICT_MUST_BE_NUMBER(400, "字典的值必须为数字"), |
| | | REQUEST_NULL(400, "请求有错误"), |
| | | SESSION_TIMEOUT(400, "会话超时"), |
| | | SERVER_ERROR(500, "服务器异常"), |
| | | |
| | | /** |
| | | * token异常 |
| | | */ |
| | | TOKEN_EXPIRED(600, "token过期"), |
| | | TOKEN_ERROR(600, "token验证失败"), |
| | | |
| | | /** |
| | | * 签名异常 |
| | | */ |
| | | SIGN_ERROR(700, "签名验证失败"), |
| | | |
| | | /** |
| | | * 其他 |
| | | */ |
| | | AUTH_REQUEST_ERROR(400, "账号密码错误"); |
| | | |
| | | BizExceptionEnum(int code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | |
| | | private Integer code; |
| | | |
| | | private String message; |
| | | |
| | | @Override |
| | | public Integer getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(Integer code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.common.exception; |
| | | |
| | | /** |
| | | * 验证码错误异常 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-05 23:52 |
| | | */ |
| | | public class InvalidKaptchaException extends RuntimeException { |
| | | } |
New file |
| | |
| | | /* |
| | | * Licensed to the Apache Software Foundation (ASF) under one |
| | | * or more contributor license agreements. See the NOTICE file |
| | | * distributed with this work for additional information |
| | | * regarding copyright ownership. The ASF licenses this file |
| | | * to you under the Apache License, Version 2.0 (the |
| | | * "License"); you may not use this file except in compliance |
| | | * with the License. You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, |
| | | * software distributed under the License is distributed on an |
| | | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| | | * KIND, either express or implied. See the License for the |
| | | * specific language governing permissions and limitations |
| | | * under the License. |
| | | */ |
| | | package com.stylefeng.guns.core.intercept; |
| | | |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import org.apache.shiro.subject.Subject; |
| | | import org.apache.shiro.web.filter.AccessControlFilter; |
| | | import org.apache.shiro.web.util.WebUtils; |
| | | |
| | | import javax.servlet.ServletRequest; |
| | | import javax.servlet.ServletResponse; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * Filter that allows access to resources if the accessor is a known user, which is defined as |
| | | * having a known principal. This means that any user who is authenticated or remembered via a |
| | | * 'remember me' feature will be allowed access from this filter. |
| | | * <p/> |
| | | * If the accessor is not a known user, then they will be redirected to the {@link #setLoginUrl(String) loginUrl}</p> |
| | | * |
| | | * @since 0.9 |
| | | */ |
| | | public class GunsUserFilter extends AccessControlFilter { |
| | | |
| | | /** |
| | | * Returns <code>true</code> if the request is a |
| | | * {@link #isLoginRequest(javax.servlet.ServletRequest, javax.servlet.ServletResponse) loginRequest} or |
| | | * if the current {@link #getSubject(javax.servlet.ServletRequest, javax.servlet.ServletResponse) subject} |
| | | * is not <code>null</code>, <code>false</code> otherwise. |
| | | * |
| | | * @return <code>true</code> if the request is a |
| | | * {@link #isLoginRequest(javax.servlet.ServletRequest, javax.servlet.ServletResponse) loginRequest} or |
| | | * if the current {@link #getSubject(javax.servlet.ServletRequest, javax.servlet.ServletResponse) subject} |
| | | * is not <code>null</code>, <code>false</code> otherwise. |
| | | */ |
| | | protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) { |
| | | if (isLoginRequest(request, response)) { |
| | | return true; |
| | | } else { |
| | | Subject subject = getSubject(request, response); |
| | | // If principal is not null, then the user is known and should be allowed access. |
| | | return subject.getPrincipal() != null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * This default implementation simply calls |
| | | * {@link #saveRequestAndRedirectToLogin(javax.servlet.ServletRequest, javax.servlet.ServletResponse) saveRequestAndRedirectToLogin} |
| | | * and then immediately returns <code>false</code>, thereby preventing the chain from continuing so the redirect may |
| | | * execute. |
| | | */ |
| | | protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception { |
| | | HttpServletRequest httpServletRequest = WebUtils.toHttp(request); |
| | | HttpServletResponse httpServletResponse = WebUtils.toHttp(response); |
| | | |
| | | /** |
| | | * 如果是ajax请求则不进行跳转 |
| | | */ |
| | | if (httpServletRequest.getHeader("x-requested-with") != null |
| | | && httpServletRequest.getHeader("x-requested-with").equalsIgnoreCase("XMLHttpRequest")) { |
| | | httpServletResponse.setHeader("sessionstatus", "timeout"); |
| | | return false; |
| | | } else { |
| | | |
| | | /** |
| | | * 第一次点击页面 |
| | | */ |
| | | String referer = httpServletRequest.getHeader("Referer"); |
| | | if (referer == null) { |
| | | saveRequestAndRedirectToLogin(request, response); |
| | | return false; |
| | | } else { |
| | | |
| | | /** |
| | | * 从别的页面跳转过来的 |
| | | */ |
| | | if (ShiroKit.getSession().getAttribute("sessionFlag") == null) { |
| | | httpServletRequest.setAttribute("tips", "session超时"); |
| | | httpServletRequest.getRequestDispatcher("/login").forward(request, response); |
| | | return false; |
| | | } else { |
| | | saveRequestAndRedirectToLogin(request, response); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.intercept; |
| | | |
| | | import com.stylefeng.guns.core.base.tips.ErrorTip; |
| | | import com.stylefeng.guns.core.common.constant.JwtConstants; |
| | | import com.stylefeng.guns.core.common.exception.BizExceptionEnum; |
| | | import com.stylefeng.guns.core.util.JwtTokenUtil; |
| | | import com.stylefeng.guns.core.util.RenderUtil; |
| | | import io.jsonwebtoken.JwtException; |
| | | import org.springframework.web.method.HandlerMethod; |
| | | import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | |
| | | /** |
| | | * Rest Api接口鉴权 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2018/7/20 23:11 |
| | | */ |
| | | public class RestApiInteceptor extends HandlerInterceptorAdapter { |
| | | |
| | | @Override |
| | | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { |
| | | if (handler instanceof org.springframework.web.servlet.resource.ResourceHttpRequestHandler) { |
| | | return true; |
| | | } |
| | | HandlerMethod handlerMethod = (HandlerMethod) handler; |
| | | return check(request, response, handlerMethod); |
| | | } |
| | | |
| | | private boolean check(HttpServletRequest request, HttpServletResponse response, HandlerMethod handlerMethod) { |
| | | if (request.getServletPath().equals(JwtConstants.AUTH_PATH)) { |
| | | return true; |
| | | } |
| | | final String requestHeader = request.getHeader(JwtConstants.AUTH_HEADER); |
| | | String authToken; |
| | | if (requestHeader != null && requestHeader.startsWith("Bearer ")) { |
| | | authToken = requestHeader.substring(7); |
| | | |
| | | //验证token是否过期,包含了验证jwt是否正确 |
| | | try { |
| | | boolean flag = JwtTokenUtil.isTokenExpired(authToken); |
| | | if (flag) { |
| | | RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_EXPIRED.getCode(), BizExceptionEnum.TOKEN_EXPIRED.getMessage())); |
| | | return false; |
| | | } |
| | | } catch (JwtException e) { |
| | | //有异常就是token解析失败 |
| | | RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_ERROR.getCode(), BizExceptionEnum.TOKEN_ERROR.getMessage())); |
| | | return false; |
| | | } |
| | | } else { |
| | | //header没有带Bearer字段 |
| | | RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_ERROR.getCode(), BizExceptionEnum.TOKEN_ERROR.getMessage())); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.intercept; |
| | | |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.util.HttpSessionHolder; |
| | | import org.aspectj.lang.ProceedingJoinPoint; |
| | | import org.aspectj.lang.annotation.Around; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.annotation.Pointcut; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 静态调用session的拦截器 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年11月13日 下午10:15:42 |
| | | */ |
| | | @Aspect |
| | | @Component |
| | | public class SessionHolderInterceptor extends BaseController { |
| | | |
| | | @Pointcut("execution(* com.stylefeng.guns.*..controller.*.*(..))") |
| | | public void cutService() { |
| | | } |
| | | |
| | | @Around("cutService()") |
| | | public Object sessionKit(ProceedingJoinPoint point) throws Throwable { |
| | | HttpSessionHolder.put(super.getHttpServletRequest().getSession()); |
| | | try { |
| | | return point.proceed(); |
| | | } finally { |
| | | HttpSessionHolder.remove(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2017, 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.stylefeng.guns.core.listener; |
| | | |
| | | import javax.servlet.ServletContext; |
| | | import javax.servlet.ServletContextEvent; |
| | | import javax.servlet.ServletContextListener; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * ServletContext监听器 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2018/2/22 21:07 |
| | | */ |
| | | public class ConfigListener implements ServletContextListener { |
| | | |
| | | private static Map<String, String> conf = new HashMap<>(); |
| | | |
| | | public static Map<String, String> getConf() { |
| | | return conf; |
| | | } |
| | | |
| | | @Override |
| | | public void contextDestroyed(ServletContextEvent arg0) { |
| | | conf.clear(); |
| | | } |
| | | |
| | | @Override |
| | | public void contextInitialized(ServletContextEvent evt) { |
| | | ServletContext sc = evt.getServletContext(); |
| | | |
| | | //项目发布,当前运行环境的绝对路径 |
| | | conf.put("realPath", sc.getRealPath("/").replaceFirst("/", "")); |
| | | |
| | | //servletContextPath,默认"" |
| | | conf.put("contextPath", sc.getContextPath()); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.log; |
| | | |
| | | import java.util.TimerTask; |
| | | import java.util.concurrent.ScheduledThreadPoolExecutor; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * 日志管理器 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-03-30 16:29 |
| | | */ |
| | | public class LogManager { |
| | | |
| | | //日志记录操作延时 |
| | | private final int OPERATE_DELAY_TIME = 10; |
| | | |
| | | //异步操作记录日志的线程池 |
| | | private ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(10); |
| | | |
| | | private LogManager() { |
| | | } |
| | | |
| | | public static LogManager logManager = new LogManager(); |
| | | |
| | | public static LogManager me() { |
| | | return logManager; |
| | | } |
| | | |
| | | public void executeLog(TimerTask task) { |
| | | executor.schedule(task, OPERATE_DELAY_TIME, TimeUnit.MILLISECONDS); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.log; |
| | | |
| | | import com.stylefeng.guns.core.util.SpringContextHolder; |
| | | import org.springframework.context.annotation.Scope; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.context.WebApplicationContext; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 被修改的bean临时存放的地方 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-03-31 11:19 |
| | | */ |
| | | @Component |
| | | @Scope(scopeName = WebApplicationContext.SCOPE_SESSION) |
| | | public class LogObjectHolder implements Serializable{ |
| | | |
| | | private Object object = null; |
| | | |
| | | public void set(Object obj) { |
| | | this.object = obj; |
| | | } |
| | | |
| | | public Object get() { |
| | | return object; |
| | | } |
| | | |
| | | public static LogObjectHolder me(){ |
| | | LogObjectHolder bean = SpringContextHolder.getBean(LogObjectHolder.class); |
| | | return bean; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.log.factory; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.state.LogSucceed; |
| | | import com.stylefeng.guns.core.common.constant.state.LogType; |
| | | import com.stylefeng.guns.modular.system.model.LoginLog; |
| | | import com.stylefeng.guns.modular.system.model.OperationLog; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 日志对象创建工厂 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年12月6日 下午9:18:27 |
| | | */ |
| | | public class LogFactory { |
| | | |
| | | /** |
| | | * 创建操作日志 |
| | | */ |
| | | public static OperationLog createOperationLog(LogType logType, Integer userId, String bussinessName, String clazzName, String methodName, String msg, LogSucceed succeed) { |
| | | OperationLog operationLog = new OperationLog(); |
| | | operationLog.setLogtype(logType.getMessage()); |
| | | operationLog.setLogname(bussinessName); |
| | | operationLog.setUserid(userId); |
| | | operationLog.setClassname(clazzName); |
| | | operationLog.setMethod(methodName); |
| | | operationLog.setCreatetime(new Date()); |
| | | operationLog.setSucceed(succeed.getMessage()); |
| | | operationLog.setMessage(msg); |
| | | return operationLog; |
| | | } |
| | | |
| | | /** |
| | | * 创建登录日志 |
| | | */ |
| | | public static LoginLog createLoginLog(LogType logType, Integer userId, String msg, String ip) { |
| | | LoginLog loginLog = new LoginLog(); |
| | | loginLog.setLogname(logType.getMessage()); |
| | | loginLog.setUserid(userId); |
| | | loginLog.setCreatetime(new Date()); |
| | | loginLog.setSucceed(LogSucceed.SUCCESS.getMessage()); |
| | | loginLog.setIp(ip); |
| | | loginLog.setMessage(msg); |
| | | return loginLog; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.log.factory; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.state.LogSucceed; |
| | | import com.stylefeng.guns.core.common.constant.state.LogType; |
| | | import com.stylefeng.guns.modular.system.dao.LoginLogMapper; |
| | | import com.stylefeng.guns.modular.system.dao.OperationLogMapper; |
| | | import com.stylefeng.guns.modular.system.model.LoginLog; |
| | | import com.stylefeng.guns.modular.system.model.OperationLog; |
| | | import com.stylefeng.guns.core.db.Db; |
| | | import com.stylefeng.guns.core.log.LogManager; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.util.TimerTask; |
| | | |
| | | /** |
| | | * 日志操作任务创建工厂 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年12月6日 下午9:18:27 |
| | | */ |
| | | public class LogTaskFactory { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(LogManager.class); |
| | | private static LoginLogMapper loginLogMapper = Db.getMapper(LoginLogMapper.class); |
| | | private static OperationLogMapper operationLogMapper = Db.getMapper(OperationLogMapper.class); |
| | | |
| | | public static TimerTask loginLog(final Integer userId, final String ip) { |
| | | return new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | LoginLog loginLog = LogFactory.createLoginLog(LogType.LOGIN, userId, null, ip); |
| | | loginLogMapper.insert(loginLog); |
| | | } catch (Exception e) { |
| | | logger.error("创建登录日志异常!", e); |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | |
| | | public static TimerTask loginLog(final String username, final String msg, final String ip) { |
| | | return new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | LoginLog loginLog = LogFactory.createLoginLog( |
| | | LogType.LOGIN_FAIL, null, "账号:" + username + "," + msg, ip); |
| | | try { |
| | | loginLogMapper.insert(loginLog); |
| | | } catch (Exception e) { |
| | | logger.error("创建登录失败异常!", e); |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | |
| | | public static TimerTask exitLog(final Integer userId, final String ip) { |
| | | return new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | LoginLog loginLog = LogFactory.createLoginLog(LogType.EXIT, userId, null,ip); |
| | | try { |
| | | loginLogMapper.insert(loginLog); |
| | | } catch (Exception e) { |
| | | logger.error("创建退出日志异常!", e); |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | |
| | | public static TimerTask bussinessLog(final Integer userId, final String bussinessName, final String clazzName, final String methodName, final String msg) { |
| | | return new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | OperationLog operationLog = LogFactory.createOperationLog( |
| | | LogType.BUSSINESS, userId, bussinessName, clazzName, methodName, msg, LogSucceed.SUCCESS); |
| | | try { |
| | | operationLogMapper.insert(operationLog); |
| | | } catch (Exception e) { |
| | | logger.error("创建业务日志异常!", e); |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | |
| | | public static TimerTask exceptionLog(final Integer userId, final Exception exception) { |
| | | return new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | String msg = ToolUtil.getExceptionMsg(exception); |
| | | OperationLog operationLog = LogFactory.createOperationLog( |
| | | LogType.EXCEPTION, userId, "", null, null, msg, LogSucceed.FAIL); |
| | | try { |
| | | operationLogMapper.insert(operationLog); |
| | | } catch (Exception e) { |
| | | logger.error("创建异常日志异常!", e); |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.shiro; |
| | | |
| | | import com.stylefeng.guns.core.shiro.factory.IShiro; |
| | | import com.stylefeng.guns.core.shiro.factory.ShiroFactroy; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import org.apache.shiro.authc.AuthenticationException; |
| | | import org.apache.shiro.authc.AuthenticationInfo; |
| | | import org.apache.shiro.authc.AuthenticationToken; |
| | | import org.apache.shiro.authc.UsernamePasswordToken; |
| | | import org.apache.shiro.authc.credential.CredentialsMatcher; |
| | | import org.apache.shiro.authc.credential.HashedCredentialsMatcher; |
| | | import org.apache.shiro.authz.AuthorizationInfo; |
| | | import org.apache.shiro.authz.SimpleAuthorizationInfo; |
| | | import org.apache.shiro.realm.AuthorizingRealm; |
| | | import org.apache.shiro.subject.PrincipalCollection; |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | public class ShiroDbRealm extends AuthorizingRealm { |
| | | |
| | | /** |
| | | * 登录认证 |
| | | */ |
| | | @Override |
| | | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) |
| | | throws AuthenticationException { |
| | | IShiro shiroFactory = ShiroFactroy.me(); |
| | | UsernamePasswordToken token = (UsernamePasswordToken) authcToken; |
| | | User user = shiroFactory.user(token.getUsername()); |
| | | ShiroUser shiroUser = shiroFactory.shiroUser(user); |
| | | return shiroFactory.info(shiroUser, user, super.getName()); |
| | | } |
| | | |
| | | /** |
| | | * 权限认证 |
| | | */ |
| | | @Override |
| | | protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { |
| | | IShiro shiroFactory = ShiroFactroy.me(); |
| | | ShiroUser shiroUser = (ShiroUser) principals.getPrimaryPrincipal(); |
| | | List<Integer> roleList = shiroUser.getRoleList(); |
| | | |
| | | Set<String> permissionSet = new HashSet<>(); |
| | | Set<String> roleNameSet = new HashSet<>(); |
| | | |
| | | for (Integer roleId : roleList) { |
| | | List<String> permissions = shiroFactory.findPermissionsByRoleId(roleId); |
| | | if (permissions != null) { |
| | | for (String permission : permissions) { |
| | | if (ToolUtil.isNotEmpty(permission)) { |
| | | permissionSet.add(permission); |
| | | } |
| | | } |
| | | } |
| | | String roleName = shiroFactory.findRoleNameByRoleId(roleId); |
| | | roleNameSet.add(roleName); |
| | | } |
| | | |
| | | SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); |
| | | info.addStringPermissions(permissionSet); |
| | | info.addRoles(roleNameSet); |
| | | return info; |
| | | } |
| | | |
| | | /** |
| | | * 设置认证加密方式 |
| | | */ |
| | | @Override |
| | | public void setCredentialsMatcher(CredentialsMatcher credentialsMatcher) { |
| | | HashedCredentialsMatcher md5CredentialsMatcher = new HashedCredentialsMatcher(); |
| | | md5CredentialsMatcher.setHashAlgorithmName(ShiroKit.hashAlgorithmName); |
| | | md5CredentialsMatcher.setHashIterations(ShiroKit.hashIterations); |
| | | super.setCredentialsMatcher(md5CredentialsMatcher); |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2017, 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.stylefeng.guns.core.shiro; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.Const; |
| | | import com.stylefeng.guns.core.common.constant.factory.ConstantFactory; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.crypto.hash.Md5Hash; |
| | | import org.apache.shiro.crypto.hash.SimpleHash; |
| | | import org.apache.shiro.session.Session; |
| | | import org.apache.shiro.subject.Subject; |
| | | import org.apache.shiro.util.ByteSource; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * shiro工具类 |
| | | * |
| | | * @author dafei, Chill Zhuang |
| | | */ |
| | | public class ShiroKit { |
| | | |
| | | private static final String NAMES_DELIMETER = ","; |
| | | |
| | | /** |
| | | * 加盐参数 |
| | | */ |
| | | public final static String hashAlgorithmName = "MD5"; |
| | | |
| | | /** |
| | | * 循环次数 |
| | | */ |
| | | public final static int hashIterations = 1024; |
| | | |
| | | /** |
| | | * shiro密码加密工具类 |
| | | * |
| | | * @param credentials 密码 |
| | | * @param saltSource 密码盐 |
| | | * @return |
| | | */ |
| | | public static String md5(String credentials, String saltSource) { |
| | | ByteSource salt = new Md5Hash(saltSource); |
| | | return new SimpleHash(hashAlgorithmName, credentials, salt, hashIterations).toString(); |
| | | } |
| | | |
| | | /** |
| | | * 获取随机盐值 |
| | | * @param length |
| | | * @return |
| | | */ |
| | | public static String getRandomSalt(int length) { |
| | | return ToolUtil.getRandomString(length); |
| | | } |
| | | |
| | | /** |
| | | * 获取当前 Subject |
| | | * |
| | | * @return Subject |
| | | */ |
| | | public static Subject getSubject() { |
| | | return SecurityUtils.getSubject(); |
| | | } |
| | | |
| | | /** |
| | | * 获取封装的 ShiroUser |
| | | * |
| | | * @return ShiroUser |
| | | */ |
| | | public static ShiroUser getUser() { |
| | | if (isGuest()) { |
| | | return null; |
| | | } else { |
| | | return (ShiroUser) getSubject().getPrincipals().getPrimaryPrincipal(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 从shiro获取session |
| | | * |
| | | */ |
| | | public static Session getSession() { |
| | | return getSubject().getSession(); |
| | | } |
| | | |
| | | /** |
| | | * 获取shiro指定的sessionKey |
| | | * |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public static <T> T getSessionAttr(String key) { |
| | | Session session = getSession(); |
| | | return session != null ? (T) session.getAttribute(key) : null; |
| | | } |
| | | |
| | | /** |
| | | * 设置shiro指定的sessionKey |
| | | * |
| | | */ |
| | | public static void setSessionAttr(String key, Object value) { |
| | | Session session = getSession(); |
| | | session.setAttribute(key, value); |
| | | } |
| | | |
| | | /** |
| | | * 移除shiro指定的sessionKey |
| | | */ |
| | | public static void removeSessionAttr(String key) { |
| | | Session session = getSession(); |
| | | if (session != null) |
| | | session.removeAttribute(key); |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户是否属于该角色?,使用时与lacksRole 搭配使用 |
| | | * |
| | | * @param roleName |
| | | * 角色名 |
| | | * @return 属于该角色:true,否则false |
| | | */ |
| | | public static boolean hasRole(String roleName) { |
| | | return getSubject() != null && roleName != null |
| | | && roleName.length() > 0 && getSubject().hasRole(roleName); |
| | | } |
| | | |
| | | /** |
| | | * 与hasRole标签逻辑相反,当用户不属于该角色时验证通过。 |
| | | * |
| | | * @param roleName |
| | | * 角色名 |
| | | * @return 不属于该角色:true,否则false |
| | | */ |
| | | public static boolean lacksRole(String roleName) { |
| | | return !hasRole(roleName); |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户是否属于以下任意一个角色。 |
| | | * |
| | | * @param roleNames |
| | | * 角色列表 |
| | | * @return 属于:true,否则false |
| | | */ |
| | | public static boolean hasAnyRoles(String roleNames) { |
| | | boolean hasAnyRole = false; |
| | | Subject subject = getSubject(); |
| | | if (subject != null && roleNames != null && roleNames.length() > 0) { |
| | | for (String role : roleNames.split(NAMES_DELIMETER)) { |
| | | if (subject.hasRole(role.trim())) { |
| | | hasAnyRole = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return hasAnyRole; |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户是否属于以下所有角色。 |
| | | * |
| | | * @param roleNames |
| | | * 角色列表 |
| | | * @return 属于:true,否则false |
| | | */ |
| | | public static boolean hasAllRoles(String roleNames) { |
| | | boolean hasAllRole = true; |
| | | Subject subject = getSubject(); |
| | | if (subject != null && roleNames != null && roleNames.length() > 0) { |
| | | for (String role : roleNames.split(NAMES_DELIMETER)) { |
| | | if (!subject.hasRole(role.trim())) { |
| | | hasAllRole = false; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return hasAllRole; |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户是否拥有指定权限,使用时与lacksPermission 搭配使用 |
| | | * |
| | | * @param permission |
| | | * 权限名 |
| | | * @return 拥有权限:true,否则false |
| | | */ |
| | | public static boolean hasPermission(String permission) { |
| | | return getSubject() != null && permission != null |
| | | && permission.length() > 0 |
| | | && getSubject().isPermitted(permission); |
| | | } |
| | | |
| | | /** |
| | | * 与hasPermission标签逻辑相反,当前用户没有制定权限时,验证通过。 |
| | | * |
| | | * @param permission |
| | | * 权限名 |
| | | * @return 拥有权限:true,否则false |
| | | */ |
| | | public static boolean lacksPermission(String permission) { |
| | | return !hasPermission(permission); |
| | | } |
| | | |
| | | /** |
| | | * 已认证通过的用户。不包含已记住的用户,这是与user标签的区别所在。与notAuthenticated搭配使用 |
| | | * |
| | | * @return 通过身份验证:true,否则false |
| | | */ |
| | | public static boolean isAuthenticated() { |
| | | return getSubject() != null && getSubject().isAuthenticated(); |
| | | } |
| | | |
| | | /** |
| | | * 未认证通过用户,与authenticated标签相对应。与guest标签的区别是,该标签包含已记住用户。。 |
| | | * |
| | | * @return 没有通过身份验证:true,否则false |
| | | */ |
| | | public static boolean notAuthenticated() { |
| | | return !isAuthenticated(); |
| | | } |
| | | |
| | | /** |
| | | * 认证通过或已记住的用户。与guset搭配使用。 |
| | | * |
| | | * @return 用户:true,否则 false |
| | | */ |
| | | public static boolean isUser() { |
| | | return getSubject() != null && getSubject().getPrincipal() != null; |
| | | } |
| | | |
| | | /** |
| | | * 验证当前用户是否为“访客”,即未认证(包含未记住)的用户。用user搭配使用 |
| | | * |
| | | * @return 访客:true,否则false |
| | | */ |
| | | public static boolean isGuest() { |
| | | return !isUser(); |
| | | } |
| | | |
| | | /** |
| | | * 输出当前用户信息,通常为登录帐号信息。 |
| | | * |
| | | * @return 当前用户信息 |
| | | */ |
| | | public static String principal() { |
| | | if (getSubject() != null) { |
| | | Object principal = getSubject().getPrincipal(); |
| | | return principal.toString(); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取当前用户的部门数据范围的集合 |
| | | */ |
| | | public static List<Integer> getDeptDataScope() { |
| | | Integer deptId = getUser().getDeptId(); |
| | | List<Integer> subDeptIds = ConstantFactory.me().getSubDeptId(deptId); |
| | | subDeptIds.add(deptId); |
| | | return subDeptIds; |
| | | } |
| | | |
| | | /** |
| | | * 判断当前用户是否是超级管理员 |
| | | */ |
| | | public static boolean isAdmin() { |
| | | List<Integer> roleList = ShiroKit.getUser().getRoleList(); |
| | | for (Integer integer : roleList) { |
| | | String singleRoleTip = ConstantFactory.me().getSingleRoleTip(integer); |
| | | if (singleRoleTip.equals(Const.ADMIN_NAME)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.shiro; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 自定义Authentication对象,使得Subject除了携带用户的登录名外还可以携带更多信息 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年12月5日 上午10:26:43 |
| | | */ |
| | | public class ShiroUser implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public Integer id; // 主键ID |
| | | public String account; // 账号 |
| | | public String name; // 姓名 |
| | | public Integer deptId; // 部门id |
| | | public List<Integer> roleList; // 角色集 |
| | | public String deptName; // 部门名称 |
| | | public List<String> roleNames; // 角色名称集 |
| | | |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getAccount() { |
| | | return account; |
| | | } |
| | | |
| | | public void setAccount(String account) { |
| | | this.account = account; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Integer getDeptId() { |
| | | return deptId; |
| | | } |
| | | |
| | | public void setDeptId(Integer deptId) { |
| | | this.deptId = deptId; |
| | | } |
| | | |
| | | public List<Integer> getRoleList() { |
| | | return roleList; |
| | | } |
| | | |
| | | public void setRoleList(List<Integer> roleList) { |
| | | this.roleList = roleList; |
| | | } |
| | | |
| | | public String getDeptName() { |
| | | return deptName; |
| | | } |
| | | |
| | | public void setDeptName(String deptName) { |
| | | this.deptName = deptName; |
| | | } |
| | | |
| | | public List<String> getRoleNames() { |
| | | return roleNames; |
| | | } |
| | | |
| | | public void setRoleNames(List<String> roleNames) { |
| | | this.roleNames = roleNames; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2017, 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.stylefeng.guns.core.shiro.check; |
| | | |
| | | /** |
| | | * 检查用接口 |
| | | */ |
| | | public interface ICheck { |
| | | |
| | | /** |
| | | * 检查当前登录用户是否拥有指定的角色访问当 |
| | | */ |
| | | boolean check(Object[] permissions); |
| | | |
| | | /** |
| | | * 检查当前登录用户是否拥有当前请求的servlet的权限 |
| | | */ |
| | | boolean checkAll(); |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2017, 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.stylefeng.guns.core.shiro.check; |
| | | |
| | | import com.stylefeng.guns.core.listener.ConfigListener; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.support.CollectionKit; |
| | | import com.stylefeng.guns.core.support.HttpKit; |
| | | import com.stylefeng.guns.core.util.SpringContextHolder; |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | /** |
| | | * 权限自定义检查 |
| | | */ |
| | | @Service |
| | | @DependsOn("springContextHolder") |
| | | @Transactional(readOnly = true) |
| | | public class PermissionCheckFactory implements ICheck { |
| | | |
| | | public static ICheck me() { |
| | | return SpringContextHolder.getBean(ICheck.class); |
| | | } |
| | | |
| | | @Override |
| | | public boolean check(Object[] permissions) { |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | if (null == user) { |
| | | return false; |
| | | } |
| | | String join = CollectionKit.join(permissions, ","); |
| | | if (ShiroKit.hasAnyRoles(join)) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean checkAll() { |
| | | HttpServletRequest request = HttpKit.getRequest(); |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | if (null == user) { |
| | | return false; |
| | | } |
| | | String requestURI = request.getRequestURI().replaceFirst(ConfigListener.getConf().get("contextPath"), ""); |
| | | String[] str = requestURI.split("/"); |
| | | if (str.length > 3) { |
| | | requestURI = "/" + str[1] + "/" + str[2]; |
| | | } |
| | | if (ShiroKit.hasPermission(requestURI)) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2017, 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.stylefeng.guns.core.shiro.check; |
| | | |
| | | import com.stylefeng.guns.core.util.SpringContextHolder; |
| | | |
| | | /** |
| | | * 权限检查管理器(入口) |
| | | */ |
| | | public class PermissionCheckManager { |
| | | private final static PermissionCheckManager me = new PermissionCheckManager(); |
| | | |
| | | private ICheck defaultCheckFactory = SpringContextHolder.getBean(ICheck.class); |
| | | |
| | | public static PermissionCheckManager me() { |
| | | return me; |
| | | } |
| | | |
| | | private PermissionCheckManager() { |
| | | } |
| | | |
| | | public PermissionCheckManager(ICheck checkFactory) { |
| | | this.defaultCheckFactory = checkFactory; |
| | | } |
| | | |
| | | public void setDefaultCheckFactory(ICheck defaultCheckFactory) { |
| | | this.defaultCheckFactory = defaultCheckFactory; |
| | | } |
| | | |
| | | public static boolean check(Object[] permissions) { |
| | | return me.defaultCheckFactory.check(permissions); |
| | | } |
| | | |
| | | public static boolean checkAll() { |
| | | return me.defaultCheckFactory.checkAll(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.shiro.factory; |
| | | |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import org.apache.shiro.authc.SimpleAuthenticationInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 定义shirorealm所需数据的接口 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年12月5日 上午10:23:34 |
| | | */ |
| | | public interface IShiro { |
| | | |
| | | /** |
| | | * 根据账号获取登录用户 |
| | | * |
| | | * @param account 账号 |
| | | */ |
| | | User user(String account); |
| | | |
| | | /** |
| | | * 根据系统用户获取Shiro的用户 |
| | | * |
| | | * @param user 系统用户 |
| | | */ |
| | | ShiroUser shiroUser(User user); |
| | | |
| | | /** |
| | | * 获取权限列表通过角色id |
| | | * |
| | | * @param roleId 角色id |
| | | */ |
| | | List<String> findPermissionsByRoleId(Integer roleId); |
| | | |
| | | /** |
| | | * 根据角色id获取角色名称 |
| | | * |
| | | * @param roleId 角色id |
| | | */ |
| | | String findRoleNameByRoleId(Integer roleId); |
| | | |
| | | /** |
| | | * 获取shiro的认证信息 |
| | | */ |
| | | SimpleAuthenticationInfo info(ShiroUser shiroUser, User user, String realmName); |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.shiro.factory; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.factory.ConstantFactory; |
| | | import com.stylefeng.guns.core.common.constant.state.ManagerStatus; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.Convert; |
| | | import com.stylefeng.guns.core.util.SpringContextHolder; |
| | | import com.stylefeng.guns.modular.system.dao.MenuMapper; |
| | | import com.stylefeng.guns.modular.system.dao.UserMapper; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import org.apache.shiro.authc.CredentialsException; |
| | | import org.apache.shiro.authc.LockedAccountException; |
| | | import org.apache.shiro.authc.SimpleAuthenticationInfo; |
| | | import org.apache.shiro.crypto.hash.Md5Hash; |
| | | import org.apache.shiro.util.ByteSource; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @DependsOn("springContextHolder") |
| | | @Transactional(readOnly = true) |
| | | public class ShiroFactroy implements IShiro { |
| | | |
| | | @Autowired |
| | | private UserMapper userMapper; |
| | | |
| | | @Autowired |
| | | private MenuMapper menuMapper; |
| | | |
| | | public static IShiro me() { |
| | | return SpringContextHolder.getBean(IShiro.class); |
| | | } |
| | | |
| | | @Override |
| | | public User user(String account) { |
| | | |
| | | User user = userMapper.getByAccount(account); |
| | | |
| | | // 账号不存在 |
| | | if (null == user) { |
| | | throw new CredentialsException(); |
| | | } |
| | | // 账号被冻结 |
| | | if (user.getStatus() != ManagerStatus.OK.getCode()) { |
| | | throw new LockedAccountException(); |
| | | } |
| | | return user; |
| | | } |
| | | |
| | | @Override |
| | | public ShiroUser shiroUser(User user) { |
| | | ShiroUser shiroUser = new ShiroUser(); |
| | | |
| | | shiroUser.setId(user.getId()); |
| | | shiroUser.setAccount(user.getAccount()); |
| | | shiroUser.setDeptId(user.getDeptid()); |
| | | shiroUser.setDeptName(ConstantFactory.me().getDeptName(user.getDeptid())); |
| | | shiroUser.setName(user.getName()); |
| | | |
| | | Integer[] roleArray = Convert.toIntArray(user.getRoleid()); |
| | | List<Integer> roleList = new ArrayList<Integer>(); |
| | | List<String> roleNameList = new ArrayList<String>(); |
| | | for (int roleId : roleArray) { |
| | | roleList.add(roleId); |
| | | roleNameList.add(ConstantFactory.me().getSingleRoleName(roleId)); |
| | | } |
| | | shiroUser.setRoleList(roleList); |
| | | shiroUser.setRoleNames(roleNameList); |
| | | |
| | | return shiroUser; |
| | | } |
| | | |
| | | @Override |
| | | public List<String> findPermissionsByRoleId(Integer roleId) { |
| | | return menuMapper.getResUrlsByRoleId(roleId); |
| | | } |
| | | |
| | | @Override |
| | | public String findRoleNameByRoleId(Integer roleId) { |
| | | return ConstantFactory.me().getSingleRoleTip(roleId); |
| | | } |
| | | |
| | | @Override |
| | | public SimpleAuthenticationInfo info(ShiroUser shiroUser, User user, String realmName) { |
| | | String credentials = user.getPassword(); |
| | | |
| | | // 密码加盐处理 |
| | | String source = user.getSalt(); |
| | | ByteSource credentialsSalt = new Md5Hash(source); |
| | | return new SimpleAuthenticationInfo(shiroUser, credentials, credentialsSalt, realmName); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.tag; |
| | | |
| | | import com.stylefeng.guns.core.common.exception.BizExceptionEnum; |
| | | import com.stylefeng.guns.core.exception.GunsException; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.Dict; |
| | | import com.stylefeng.guns.modular.system.service.IDictService; |
| | | import org.beetl.core.Tag; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Scope; |
| | | import org.springframework.stereotype.Component; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 字典标签渲染 |
| | | * |
| | | * @author zhangjiajia |
| | | * @Date 2018年6月4日17:33:32 |
| | | */ |
| | | @Component |
| | | @Scope("prototype") |
| | | public class DictSelectorTag extends Tag { |
| | | |
| | | @Autowired |
| | | IDictService iDictService; |
| | | |
| | | @Override |
| | | public void render(){ |
| | | //String tagName = (String) this.args[0]; |
| | | Map attrs = (Map) args[1]; |
| | | if(ToolUtil.isEmpty(attrs.get("code"))){ |
| | | throw new GunsException(BizExceptionEnum.ERROR_CODE_EMPTY); |
| | | } |
| | | |
| | | //字典类型编码 |
| | | String code = attrs.get("code").toString(); |
| | | //控件显示类型select 选择框,radio 单选按钮,checkbox 多选按钮 |
| | | String type = ToolUtil.isNotEmpty(attrs.get("type"))?attrs.get("type").toString():"select"; |
| | | //开启多选 |
| | | String multiple = ToolUtil.isNotEmpty(attrs.get("multiple"))?attrs.get("multiple").toString():""; |
| | | //字典名称 |
| | | String label = ToolUtil.isNotEmpty(attrs.get("label"))?attrs.get("label").toString():""; |
| | | //提示 |
| | | String placeholder = (ToolUtil.isNotEmpty(attrs.get("placeholder"))?attrs.get("placeholder").toString():""); |
| | | //宽度 |
| | | String width = ToolUtil.isNotEmpty(attrs.get("width"))?attrs.get("width").toString():"248"; |
| | | //默认值 |
| | | String value = ToolUtil.isNotEmpty(attrs.get("value"))?attrs.get("value").toString():""; |
| | | //id |
| | | String id = ToolUtil.isNotEmpty(attrs.get("id"))?attrs.get("id").toString():""; |
| | | //name |
| | | String name = ToolUtil.isNotEmpty(attrs.get("name"))?attrs.get("name").toString():""; |
| | | //分割线 |
| | | String underline = ToolUtil.isNotEmpty(attrs.get("underline"))?attrs.get("underline").toString():""; |
| | | //onchange事件 |
| | | String onchange = ToolUtil.isNotEmpty(attrs.get("onchange"))?attrs.get("onchange").toString():""; |
| | | //readonly属性 |
| | | String readonly = ToolUtil.isNotEmpty(attrs.get("readonly"))?attrs.get("readonly").toString():""; |
| | | //disabled属性 |
| | | String disabled = ToolUtil.isNotEmpty(attrs.get("disabled"))?attrs.get("disabled").toString():""; |
| | | //searchnum 下拉选项数量达到多少启用搜索,默认10 |
| | | int searchnum = ToolUtil.isNum(attrs.get("searchnum"))?Integer.parseInt(attrs.get("searchnum").toString()):10; |
| | | //根据code查询字典数据 |
| | | List<Dict> list = iDictService.selectByParentCode(code); |
| | | |
| | | StringBuffer html = new StringBuffer(); |
| | | html.append("<div class=\"form-group\">\r\n"); |
| | | html.append("<label class=\"col-sm-3 control-label\">"+label+"</label>\r\n"); |
| | | html.append("<div class=\"col-sm-9\">\r\n"); |
| | | |
| | | //单选按钮 |
| | | if("radio".equals(type)) { |
| | | |
| | | list.forEach(obj->{ |
| | | html.append("<label class=\"radio-inline i-checks\">\r\n<input type=\"radio\" "); |
| | | //判断控件是否禁用 |
| | | if("true".equals(disabled)||"disabled".equals(disabled)) { |
| | | html.append("disabled "); |
| | | }else{ |
| | | if(ToolUtil.isNotEmpty(name)){ |
| | | html.append("name=\""+name+"\" "); |
| | | } |
| | | } |
| | | if("true".equals(readonly)||"disabled".equals(readonly)) { |
| | | html.append("disabled "); |
| | | } |
| | | if(ToolUtil.isNotEmpty(value)&&value.equals(obj.getCode())){ |
| | | html.append("checked "); |
| | | } |
| | | |
| | | html.append("value=\""+obj.getCode()+"\" >"+obj.getName()+"</label>\r\n"); |
| | | }); |
| | | |
| | | //多选按钮 |
| | | }else if("checkbox".equals(type)){ |
| | | list.forEach(obj->{ |
| | | html.append("<label class=\"checkbox-inline i-checks\">\r\n<input type=\"checkbox\" "); |
| | | //判断控件是否禁用 |
| | | if("true".equals(disabled)||"disabled".equals(disabled)) { |
| | | html.append("disabled "); |
| | | }else{ |
| | | if(ToolUtil.isNotEmpty(name)){ |
| | | html.append("name=\""+name+"\" "); |
| | | } |
| | | } |
| | | if("true".equals(readonly)||"disabled".equals(readonly)) { |
| | | html.append("disabled "); |
| | | } |
| | | if(ToolUtil.isNotEmpty(value)&&value.equals(obj.getCode())){ |
| | | html.append("checked "); |
| | | } |
| | | |
| | | html.append("value=\""+obj.getCode()+"\" >"+obj.getName()+"</label>\r\n"); |
| | | }); |
| | | |
| | | //默认select |
| | | }else{ |
| | | //开启多选 |
| | | if("true".equals(multiple)){ |
| | | if(list.size()>=searchnum) { |
| | | html.append("<select multiple "); |
| | | }else{ |
| | | html.append("<select multiple=\"multiple\" size=\"10\" "); |
| | | } |
| | | }else{ |
| | | html.append("<select "); |
| | | } |
| | | |
| | | //判断控件是否启用提示 |
| | | if(ToolUtil.isNotEmpty(placeholder)){ |
| | | html.append(" data-placeholder=\""+placeholder+"\" "); |
| | | } |
| | | |
| | | //判断控件是否禁用 |
| | | if("true".equals(disabled)||"disabled".equals(disabled)) { |
| | | html.append("disabled=\"disabled\" "); |
| | | }else{ |
| | | //启用 |
| | | if(ToolUtil.isNotEmpty(id)){ |
| | | html.append("id=\""+id+"\" "); |
| | | } |
| | | |
| | | if(ToolUtil.isNotEmpty(name)){ |
| | | html.append("name=\""+name+"\" "); |
| | | } |
| | | } |
| | | |
| | | //判断是否启用搜索框 |
| | | //判断下拉数据,如果查询出来的条数达到启用搜索的数量就启用 |
| | | |
| | | |
| | | if(list.size()>=searchnum){ |
| | | html.append("class=\"form-control chosen-select\" style=\"width:"+width+"px\" tabindex=\"1\" \r\n"); |
| | | } else{ |
| | | html.append("class=\"form-control\" style=\"width:"+width+"px\" \r\n"); |
| | | } |
| | | |
| | | //判断控件是否只读 |
| | | if("true".equals(readonly)||"readonly".equals(readonly)) { |
| | | if(list.size()>=searchnum) { |
| | | html.append("disabled=\"disabled\" "); |
| | | }else{ |
| | | html.append("onfocus=\"this.defaultIndex=this.selectedIndex;\" onchange=\"this.selectedIndex=this.defaultIndex;\" "); |
| | | } |
| | | } |
| | | |
| | | //判断是否绑定onchange事件 |
| | | if(ToolUtil.isNotEmpty(onchange)){ |
| | | html.append("onchange=\""+onchange+"($(this).children('option:selected').val())\" "); |
| | | } |
| | | |
| | | html.append(">"); |
| | | if(ToolUtil.isNotEmpty(placeholder)){ |
| | | html.append("<option value=\"\">"+placeholder+"</option>\r\n"); |
| | | } |
| | | //将查询出来的数据添加到select中 |
| | | list.forEach(obj->{ |
| | | if(ToolUtil.isNotEmpty(value)&&value.equals(obj.getCode())){ |
| | | html.append("<option selected value=\""+obj.getCode()+"\">"+obj.getName()+"</option>\r\n"); |
| | | }else{ |
| | | html.append("<option value=\""+obj.getCode()+"\">"+obj.getName()+"</option>\r\n"); |
| | | } |
| | | }); |
| | | html.append("</select>\r\n"); |
| | | } |
| | | |
| | | html.append("</div>\r\n</div>\r\n"); |
| | | //判断是否添加分割线 |
| | | if(ToolUtil.isNotEmpty(underline) && "true".equals(underline)) { |
| | | html.append("<div class=\"hr-line-dashed\" ></div >\r\n"); |
| | | } |
| | | |
| | | try{ |
| | | this.ctx.byteWriter.writeString(html.toString()); |
| | | }catch (IOException e){ |
| | | throw new RuntimeException("输出字典标签错误"); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.util; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.Const; |
| | | import com.stylefeng.guns.config.properties.GunsProperties; |
| | | import com.stylefeng.guns.core.node.MenuNode; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * api接口文档显示过滤 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-08-17 16:55 |
| | | */ |
| | | public class ApiMenuFilter extends MenuNode { |
| | | |
| | | public static List<MenuNode> build(List<MenuNode> nodes) { |
| | | |
| | | //如果关闭了接口文档,则不显示接口文档菜单 |
| | | GunsProperties gunsProperties = SpringContextHolder.getBean(GunsProperties.class); |
| | | if (!gunsProperties.getSwaggerOpen()) { |
| | | List<MenuNode> menuNodesCopy = new ArrayList<>(); |
| | | for (MenuNode menuNode : nodes) { |
| | | if (Const.API_MENU_NAME.equals(menuNode.getName())) { |
| | | continue; |
| | | } else { |
| | | menuNodesCopy.add(menuNode); |
| | | } |
| | | } |
| | | nodes = menuNodesCopy; |
| | | } |
| | | |
| | | return nodes; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.util; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.dictmap.base.AbstractDictMap; |
| | | import com.stylefeng.guns.core.common.constant.dictmap.factory.DictFieldWarpperFactory; |
| | | import com.stylefeng.guns.core.support.StrKit; |
| | | |
| | | import java.beans.PropertyDescriptor; |
| | | import java.lang.reflect.Field; |
| | | import java.lang.reflect.Method; |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 对比两个对象的变化的工具类 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017/3/31 10:36 |
| | | */ |
| | | public class Contrast { |
| | | |
| | | //记录每个修改字段的分隔符 |
| | | public static final String separator = ";;;"; |
| | | |
| | | /** |
| | | * 比较两个对象,并返回不一致的信息 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/9 19:34 |
| | | */ |
| | | public static String contrastObj(Object pojo1, Object pojo2) { |
| | | String str = ""; |
| | | try { |
| | | Class clazz = pojo1.getClass(); |
| | | Field[] fields = pojo1.getClass().getDeclaredFields(); |
| | | int i = 1; |
| | | for (Field field : fields) { |
| | | if ("serialVersionUID".equals(field.getName())) { |
| | | continue; |
| | | } |
| | | PropertyDescriptor pd = new PropertyDescriptor(field.getName(), clazz); |
| | | Method getMethod = pd.getReadMethod(); |
| | | Object o1 = getMethod.invoke(pojo1); |
| | | Object o2 = getMethod.invoke(pojo2); |
| | | if (o1 == null || o2 == null) { |
| | | continue; |
| | | } |
| | | if (o1 instanceof Date) { |
| | | o1 = DateUtil.getDay((Date) o1); |
| | | } |
| | | if (!o1.toString().equals(o2.toString())) { |
| | | if (i != 1) { |
| | | str += separator; |
| | | } |
| | | str += "字段名称" + field.getName() + ",旧值:" + o1 + ",新值:" + o2; |
| | | i++; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 比较两个对象pojo1和pojo2,并输出不一致信息 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/9 19:34 |
| | | */ |
| | | public static String contrastObj(Class dictClass, String key, Object pojo1, Map<String, String> pojo2) throws IllegalAccessException, InstantiationException { |
| | | AbstractDictMap dictMap = (AbstractDictMap) dictClass.newInstance(); |
| | | String str = parseMutiKey(dictMap, key, pojo2) + separator; |
| | | try { |
| | | Class clazz = pojo1.getClass(); |
| | | Field[] fields = pojo1.getClass().getDeclaredFields(); |
| | | int i = 1; |
| | | for (Field field : fields) { |
| | | if ("serialVersionUID".equals(field.getName())) { |
| | | continue; |
| | | } |
| | | PropertyDescriptor pd = new PropertyDescriptor(field.getName(), clazz); |
| | | Method getMethod = pd.getReadMethod(); |
| | | Object o1 = getMethod.invoke(pojo1); |
| | | Object o2 = pojo2.get(StrKit.firstCharToLowerCase(getMethod.getName().substring(3))); |
| | | if (o1 == null || o2 == null) { |
| | | continue; |
| | | } |
| | | if (o1 instanceof Date) { |
| | | o1 = DateUtil.getDay((Date) o1); |
| | | } else if (o1 instanceof Integer) { |
| | | o2 = Integer.parseInt(o2.toString()); |
| | | } |
| | | if (!o1.toString().equals(o2.toString())) { |
| | | if (i != 1) { |
| | | str += separator; |
| | | } |
| | | String fieldName = dictMap.get(field.getName()); |
| | | String fieldWarpperMethodName = dictMap.getFieldWarpperMethodName(field.getName()); |
| | | if (fieldWarpperMethodName != null) { |
| | | Object o1Warpper = DictFieldWarpperFactory.createFieldWarpper(o1, fieldWarpperMethodName); |
| | | Object o2Warpper = DictFieldWarpperFactory.createFieldWarpper(o2, fieldWarpperMethodName); |
| | | str += "字段名称:" + fieldName + ",旧值:" + o1Warpper + ",新值:" + o2Warpper; |
| | | } else { |
| | | str += "字段名称:" + fieldName + ",旧值:" + o1 + ",新值:" + o2; |
| | | } |
| | | i++; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 比较两个对象pojo1和pojo2,并输出不一致信息 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/9 19:34 |
| | | */ |
| | | public static String contrastObjByName(Class dictClass, String key, Object pojo1, Map<String, String> pojo2) throws IllegalAccessException, InstantiationException { |
| | | AbstractDictMap dictMap = (AbstractDictMap) dictClass.newInstance(); |
| | | String str = parseMutiKey(dictMap, key, pojo2) + separator; |
| | | try { |
| | | Class clazz = pojo1.getClass(); |
| | | Field[] fields = pojo1.getClass().getDeclaredFields(); |
| | | int i = 1; |
| | | for (Field field : fields) { |
| | | if ("serialVersionUID".equals(field.getName())) { |
| | | continue; |
| | | } |
| | | String prefix = "get"; |
| | | int prefixLength = 3; |
| | | if (field.getType().getName().equals("java.lang.Boolean")) { |
| | | prefix = "is"; |
| | | prefixLength = 2; |
| | | } |
| | | Method getMethod = null; |
| | | try { |
| | | getMethod = clazz.getDeclaredMethod(prefix + StrKit.firstCharToUpperCase(field.getName())); |
| | | } catch (java.lang.NoSuchMethodException e) { |
| | | System.err.println("this className:" + clazz.getName() + " is not methodName: " + e.getMessage()); |
| | | continue; |
| | | } |
| | | Object o1 = getMethod.invoke(pojo1); |
| | | Object o2 = pojo2.get(StrKit.firstCharToLowerCase(getMethod.getName().substring(prefixLength))); |
| | | if (o1 == null || o2 == null) { |
| | | continue; |
| | | } |
| | | if (o1 instanceof Date) { |
| | | o1 = DateUtil.getDay((Date) o1); |
| | | } else if (o1 instanceof Integer) { |
| | | o2 = Integer.parseInt(o2.toString()); |
| | | } |
| | | if (!o1.toString().equals(o2.toString())) { |
| | | if (i != 1) { |
| | | str += separator; |
| | | } |
| | | String fieldName = dictMap.get(field.getName()); |
| | | String fieldWarpperMethodName = dictMap.getFieldWarpperMethodName(field.getName()); |
| | | if (fieldWarpperMethodName != null) { |
| | | Object o1Warpper = DictFieldWarpperFactory.createFieldWarpper(o1, fieldWarpperMethodName); |
| | | Object o2Warpper = DictFieldWarpperFactory.createFieldWarpper(o2, fieldWarpperMethodName); |
| | | str += "字段名称:" + fieldName + ",旧值:" + o1Warpper + ",新值:" + o2Warpper; |
| | | } else { |
| | | str += "字段名称:" + fieldName + ",旧值:" + o1 + ",新值:" + o2; |
| | | } |
| | | i++; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 解析多个key(逗号隔开的) |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/16 22:19 |
| | | */ |
| | | public static String parseMutiKey(AbstractDictMap dictMap, String key, Map<String, String> requests) { |
| | | StringBuilder sb = new StringBuilder(); |
| | | if (key.indexOf(",") != -1) { |
| | | String[] keys = key.split(","); |
| | | for (String item : keys) { |
| | | String fieldWarpperMethodName = dictMap.getFieldWarpperMethodName(item); |
| | | String value = requests.get(item); |
| | | if (fieldWarpperMethodName != null) { |
| | | Object valueWarpper = DictFieldWarpperFactory.createFieldWarpper(value, fieldWarpperMethodName); |
| | | sb.append(dictMap.get(item) + "=" + valueWarpper + ","); |
| | | } else { |
| | | sb.append(dictMap.get(item) + "=" + value + ","); |
| | | } |
| | | } |
| | | return StrKit.removeSuffix(sb.toString(), ","); |
| | | } else { |
| | | String fieldWarpperMethodName = dictMap.getFieldWarpperMethodName(key); |
| | | String value = requests.get(key); |
| | | if (fieldWarpperMethodName != null) { |
| | | Object valueWarpper = DictFieldWarpperFactory.createFieldWarpper(value, fieldWarpperMethodName); |
| | | sb.append(dictMap.get(key) + "=" + valueWarpper); |
| | | } else { |
| | | sb.append(dictMap.get(key) + "=" + value); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.util; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import org.apache.http.HttpResponse; |
| | | import org.apache.http.util.EntityUtils; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | public class GetMobile { |
| | | |
| | | public static String getPhone(String accessToken,String androidOrIos){ |
| | | |
| | | |
| | | String host = "http://verifystar.market.alicloudapi.com"; |
| | | String path = "/api/v1/mobile/info"; |
| | | String method = "POST"; |
| | | String appcode = "b7d32437d08149099457dcb50fb57df2"; |
| | | Map<String, String> headers = new HashMap<String, String>(); |
| | | //最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105 |
| | | headers.put("Authorization", "APPCODE " + appcode); |
| | | //根据API的要求,定义相对应的Content-Type |
| | | headers.put("Content-Type", "application/json; charset=UTF-8"); |
| | | //需要给X-Ca-Nonce的值生成随机字符串,每次请求不能相同 |
| | | headers.put("X-Ca-Nonce", UUID.randomUUID().toString()); |
| | | Map<String, String> querys = new HashMap<String, String>(); |
| | | if(androidOrIos.equals("android")){ |
| | | querys.put("appkey", "5f02e3cc978eea07661bde20"); |
| | | querys.put("verifyId", ""); |
| | | }else{ |
| | | querys.put("appkey", "5ee43367978eea081640dca7"); |
| | | querys.put("verifyId", ""); |
| | | } |
| | | /*;*/ |
| | | String bodys = "{\"token\":\""+accessToken+"\"}"; |
| | | try { |
| | | /** |
| | | * 重要提示如下: |
| | | * HttpUtils请从 |
| | | * https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java |
| | | * 下载 |
| | | * |
| | | * 相应的依赖请参照 |
| | | * https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml |
| | | */ |
| | | |
| | | HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys); |
| | | System.out.println(response.toString()); |
| | | return EntityUtils.toString(response.getEntity()); |
| | | //获取response的body |
| | | //System.out.println(EntityUtils.toString(response.getEntity())); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | /* DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", "LTAI4G9Zez9H4B36vakPXGy4", "BOVPUeZndKVbrPOq6Ef5j6oiydB3XZ"); |
| | | IAcsClient client = new DefaultAcsClient(profile); |
| | | |
| | | GetMobileRequest request = new GetMobileRequest(); |
| | | request.setRegionId("cn-hangzhou"); |
| | | request.setAccessToken(accessToken); |
| | | |
| | | try { |
| | | GetMobileResponse response = client.getAcsResponse(request); |
| | | 才 |
| | | } catch (ServerException e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } catch (ClientException e) { |
| | | System.out.println("ErrCode:" + e.getErrCode()); |
| | | System.out.println("ErrMsg:" + e.getErrMsg()); |
| | | System.out.println("RequestId:" + e.getRequestId()); |
| | | return null; |
| | | }*/ |
| | | } |
| | | public static void main(String[] args) { |
| | | //String response = GetMobile.getPhone("eyAgIm8iIDogImlPUyIsICAiayIgOiAiY2lNVmw2S0ZyM0xlWlJOQVNSNTdZXC9WV1FZS3BCZlVSR1pQa1I5OFJFWmVJWmF3OHJGM0NVSDZQZVwvNzRPVTBSalpoZE5QT002NHl3b05yZlJkWUlrUkxVY29hdm10Rkg1ODhrNjJmXC9vdTEzalN2ZDduZDlscXFLWm5Ca2hQZzBBa09yS2M1dlwvWWY0U05lUjd4RHh6MUJoOUVYbkxnbHFEclZqVW85TXQ5XC9ieXk2SmVNVVB3UzhqRHM2N3VwUEg0SWRTNElqUUxCUXVHb1FyM1ltb1lpUnQ2R29YWlJCRzhDbndUTVBrSHM4YXNMQzRGVUpmZHcxbFlzN0srNGlyTGJSdXVacTg1NW9NMEo5b05FOExmdDZGTFpmVWVQY0d0WlwvTnhIMnFXM1ZIU3NtUEgxdHlkTzdUeGRmVUM1cEo2SmhRclVvNEdIazBXVHF3RTlCYlFnPT0iLCAgImMiIDogIkVjS0dHSzB5TjA2Tm9vSjhYV1h1K3d6eGdodElDaGpqOUtHRlliSjl4ZjhQMUR6UERsYVdRcGcxMHg5SkdNV2hcL2wyVDd4bXNxSUZmWERDZlBjZ05NdFY2dVZueEU1aGFTUUdPbFowekp4Z2JPZ3ZrR2ZkbVJvOGZFSGhEQ0czM1RYNHR5ZHJXUGFuQTBBSmo3VjljaGN0d25UT0ZzSG82WlhLOWZsQUlSbHpmNE1yaGZsRkhtTVRoejQ1UG01cHhtSlh5N3EyVlZTK0tEbU9GU2lzNlwvMnByK24zQWttazYxZ0RVUUhYV2FoVFwvYzc0dzhrTDhWYlliM3dOc0VkVEh2ZDhzYjlPbFNpVHNJUHNFUVJ6Wm9JRFJUaE5pWVg1U3VwNklQXC9LTFlLOFdaSlJWamU2QUpLT2JOakEybTlleTM0Sys2MUhtQktPNmNwTlZ4TTJITlJERjRzcG9lWStYdnhTT1pVcExaSWxXd3NFdUtUeVVBSzJUMHpOUmZBQVhlOWR6alBcL2lHSFU3aitwUWlaaU1XbHg5WGtIREM3MjNkXC80b3d2dEluem9yVlBNNjJQTzJsWWttOEt4TVVTYlRRTnBVNGZzRzlXcHB0cFJRR0JFUTYyNmxlNFFZeWdaSWxjZXlcL1VJOWlLWDVWTzhCU01VUnNoZUdNU29HejF2dmw2QUVmdTdBNm0raUhUYkxOd01uQkM3VHZ4TlYxNmd4M2dWRGtha0ZGNEdZTjZsWm0zMkNnT2hVakhlODMrUXFHNXhNNkZxUlBnMWN0QzRRN05DZFpHNUN5UEZVd2dRcUx3MFFWaE9IRnNZTFwvU3p3T1JUMFFlb0h3T1piZ3FmNU96T0k1TFwvelRqNEFJV3ZqejlteWNJZVc3cXMzXC9IdnJXck5GM3lSZCtYTml5a2d6d1RDMnZjaXRrSkszSVBENjlEVVRVVzBCNllvdng2ako5QW5xZXdUc1J3Nlp4ZXcra0xpXC9HTlB0K0hHRGVjclVZcFpwOFQ5ckN6QkM0Z0ZEa0ZOQ0Z2UkJKSE5JVGkrRGNUeWhVZz09In0=","ios"); |
| | | JSONObject json = JSONObject.parseObject("{\"success\":true,\"data\":{\"mobile\":\"15608199082\",\"score\":null,\"activeScore\":null,\"aesEncryptKey\":null},\"code\":2001,\"message\":\"gain mobile's result success\",\"requestId\":\"21D1E797-2B22-4D0E-B31D-AC470F7E06E7\"}"); |
| | | String phone = json.getJSONObject("data").getString("mobile"); |
| | | //JSONObject json = JSONObject.parseObject(response); |
| | | if(json.getInteger("code")!=2003){ |
| | | System.out.println("1111="+ phone); |
| | | } |
| | | System.out.println( phone); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.util; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLEncoder; |
| | | import java.security.KeyManagementException; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.security.cert.X509Certificate; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.net.ssl.SSLContext; |
| | | import javax.net.ssl.TrustManager; |
| | | import javax.net.ssl.X509TrustManager; |
| | | |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.http.HttpResponse; |
| | | import org.apache.http.NameValuePair; |
| | | import org.apache.http.client.HttpClient; |
| | | import org.apache.http.client.entity.UrlEncodedFormEntity; |
| | | import org.apache.http.client.methods.HttpDelete; |
| | | import org.apache.http.client.methods.HttpGet; |
| | | import org.apache.http.client.methods.HttpPost; |
| | | import org.apache.http.client.methods.HttpPut; |
| | | import org.apache.http.conn.ClientConnectionManager; |
| | | import org.apache.http.conn.scheme.Scheme; |
| | | import org.apache.http.conn.scheme.SchemeRegistry; |
| | | import org.apache.http.conn.ssl.SSLSocketFactory; |
| | | import org.apache.http.entity.ByteArrayEntity; |
| | | import org.apache.http.entity.StringEntity; |
| | | import org.apache.http.impl.client.DefaultHttpClient; |
| | | import org.apache.http.message.BasicNameValuePair; |
| | | |
| | | public class HttpUtils { |
| | | |
| | | /** |
| | | * get |
| | | * |
| | | * @param host |
| | | * @param path |
| | | * @param method |
| | | * @param headers |
| | | * @param querys |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static HttpResponse doGet(String host, String path, String method, |
| | | Map<String, String> headers, |
| | | Map<String, String> querys) |
| | | throws Exception { |
| | | HttpClient httpClient = wrapClient(host); |
| | | |
| | | HttpGet request = new HttpGet(buildUrl(host, path, querys)); |
| | | for (Map.Entry<String, String> e : headers.entrySet()) { |
| | | request.addHeader(e.getKey(), e.getValue()); |
| | | } |
| | | |
| | | return httpClient.execute(request); |
| | | } |
| | | |
| | | /** |
| | | * post form |
| | | * |
| | | * @param host |
| | | * @param path |
| | | * @param method |
| | | * @param headers |
| | | * @param querys |
| | | * @param bodys |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static HttpResponse doPost(String host, String path, String method, |
| | | Map<String, String> headers, |
| | | Map<String, String> querys, |
| | | Map<String, String> bodys) |
| | | throws Exception { |
| | | HttpClient httpClient = wrapClient(host); |
| | | |
| | | HttpPost request = new HttpPost(buildUrl(host, path, querys)); |
| | | for (Map.Entry<String, String> e : headers.entrySet()) { |
| | | request.addHeader(e.getKey(), e.getValue()); |
| | | } |
| | | |
| | | if (bodys != null) { |
| | | List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>(); |
| | | |
| | | for (String key : bodys.keySet()) { |
| | | nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key))); |
| | | } |
| | | UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8"); |
| | | formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8"); |
| | | request.setEntity(formEntity); |
| | | } |
| | | |
| | | return httpClient.execute(request); |
| | | } |
| | | |
| | | /** |
| | | * Post String |
| | | * |
| | | * @param host |
| | | * @param path |
| | | * @param method |
| | | * @param headers |
| | | * @param querys |
| | | * @param body |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static HttpResponse doPost(String host, String path, String method, |
| | | Map<String, String> headers, |
| | | Map<String, String> querys, |
| | | String body) |
| | | throws Exception { |
| | | HttpClient httpClient = wrapClient(host); |
| | | |
| | | HttpPost request = new HttpPost(buildUrl(host, path, querys)); |
| | | for (Map.Entry<String, String> e : headers.entrySet()) { |
| | | request.addHeader(e.getKey(), e.getValue()); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(body)) { |
| | | request.setEntity(new StringEntity(body, "utf-8")); |
| | | } |
| | | |
| | | return httpClient.execute(request); |
| | | } |
| | | |
| | | /** |
| | | * Post stream |
| | | * |
| | | * @param host |
| | | * @param path |
| | | * @param method |
| | | * @param headers |
| | | * @param querys |
| | | * @param body |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static HttpResponse doPost(String host, String path, String method, |
| | | Map<String, String> headers, |
| | | Map<String, String> querys, |
| | | byte[] body) |
| | | throws Exception { |
| | | HttpClient httpClient = wrapClient(host); |
| | | |
| | | HttpPost request = new HttpPost(buildUrl(host, path, querys)); |
| | | for (Map.Entry<String, String> e : headers.entrySet()) { |
| | | request.addHeader(e.getKey(), e.getValue()); |
| | | } |
| | | |
| | | if (body != null) { |
| | | request.setEntity(new ByteArrayEntity(body)); |
| | | } |
| | | |
| | | return httpClient.execute(request); |
| | | } |
| | | |
| | | /** |
| | | * Put String |
| | | * @param host |
| | | * @param path |
| | | * @param method |
| | | * @param headers |
| | | * @param querys |
| | | * @param body |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static HttpResponse doPut(String host, String path, String method, |
| | | Map<String, String> headers, |
| | | Map<String, String> querys, |
| | | String body) |
| | | throws Exception { |
| | | HttpClient httpClient = wrapClient(host); |
| | | |
| | | HttpPut request = new HttpPut(buildUrl(host, path, querys)); |
| | | for (Map.Entry<String, String> e : headers.entrySet()) { |
| | | request.addHeader(e.getKey(), e.getValue()); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(body)) { |
| | | request.setEntity(new StringEntity(body, "utf-8")); |
| | | } |
| | | |
| | | return httpClient.execute(request); |
| | | } |
| | | |
| | | /** |
| | | * Put stream |
| | | * @param host |
| | | * @param path |
| | | * @param method |
| | | * @param headers |
| | | * @param querys |
| | | * @param body |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static HttpResponse doPut(String host, String path, String method, |
| | | Map<String, String> headers, |
| | | Map<String, String> querys, |
| | | byte[] body) |
| | | throws Exception { |
| | | HttpClient httpClient = wrapClient(host); |
| | | |
| | | HttpPut request = new HttpPut(buildUrl(host, path, querys)); |
| | | for (Map.Entry<String, String> e : headers.entrySet()) { |
| | | request.addHeader(e.getKey(), e.getValue()); |
| | | } |
| | | |
| | | if (body != null) { |
| | | request.setEntity(new ByteArrayEntity(body)); |
| | | } |
| | | |
| | | return httpClient.execute(request); |
| | | } |
| | | |
| | | /** |
| | | * Delete |
| | | * |
| | | * @param host |
| | | * @param path |
| | | * @param method |
| | | * @param headers |
| | | * @param querys |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static HttpResponse doDelete(String host, String path, String method, |
| | | Map<String, String> headers, |
| | | Map<String, String> querys) |
| | | throws Exception { |
| | | HttpClient httpClient = wrapClient(host); |
| | | |
| | | HttpDelete request = new HttpDelete(buildUrl(host, path, querys)); |
| | | for (Map.Entry<String, String> e : headers.entrySet()) { |
| | | request.addHeader(e.getKey(), e.getValue()); |
| | | } |
| | | |
| | | return httpClient.execute(request); |
| | | } |
| | | |
| | | private static String buildUrl(String host, String path, Map<String, String> querys) throws UnsupportedEncodingException { |
| | | StringBuilder sbUrl = new StringBuilder(); |
| | | sbUrl.append(host); |
| | | if (!StringUtils.isBlank(path)) { |
| | | sbUrl.append(path); |
| | | } |
| | | if (null != querys) { |
| | | StringBuilder sbQuery = new StringBuilder(); |
| | | for (Map.Entry<String, String> query : querys.entrySet()) { |
| | | if (0 < sbQuery.length()) { |
| | | sbQuery.append("&"); |
| | | } |
| | | if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) { |
| | | sbQuery.append(query.getValue()); |
| | | } |
| | | if (!StringUtils.isBlank(query.getKey())) { |
| | | sbQuery.append(query.getKey()); |
| | | if (!StringUtils.isBlank(query.getValue())) { |
| | | sbQuery.append("="); |
| | | sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8")); |
| | | } |
| | | } |
| | | } |
| | | if (0 < sbQuery.length()) { |
| | | sbUrl.append("?").append(sbQuery); |
| | | } |
| | | } |
| | | |
| | | return sbUrl.toString(); |
| | | } |
| | | |
| | | private static HttpClient wrapClient(String host) { |
| | | HttpClient httpClient = new DefaultHttpClient(); |
| | | if (host.startsWith("https://")) { |
| | | sslClient(httpClient); |
| | | } |
| | | |
| | | return httpClient; |
| | | } |
| | | |
| | | private static void sslClient(HttpClient httpClient) { |
| | | try { |
| | | SSLContext ctx = SSLContext.getInstance("TLS"); |
| | | X509TrustManager tm = new X509TrustManager() { |
| | | public X509Certificate[] getAcceptedIssuers() { |
| | | return null; |
| | | } |
| | | public void checkClientTrusted(X509Certificate[] xcs, String str) { |
| | | |
| | | } |
| | | public void checkServerTrusted(X509Certificate[] xcs, String str) { |
| | | |
| | | } |
| | | }; |
| | | ctx.init(null, new TrustManager[] { tm }, null); |
| | | SSLSocketFactory ssf = new SSLSocketFactory(ctx); |
| | | ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); |
| | | ClientConnectionManager ccm = httpClient.getConnectionManager(); |
| | | SchemeRegistry registry = ccm.getSchemeRegistry(); |
| | | registry.register(new Scheme("https", 443, ssf)); |
| | | } catch (KeyManagementException ex) { |
| | | throw new RuntimeException(ex); |
| | | } catch (NoSuchAlgorithmException ex) { |
| | | throw new RuntimeException(ex); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.util; |
| | | |
| | | import com.stylefeng.guns.core.common.constant.JwtConstants; |
| | | import io.jsonwebtoken.*; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p>jwt token工具类</p> |
| | | * <pre> |
| | | * jwt的claim里一般包含以下几种数据: |
| | | * 1. iss -- token的发行者 |
| | | * 2. sub -- 该JWT所面向的用户 |
| | | * 3. aud -- 接收该JWT的一方 |
| | | * 4. exp -- token的失效时间 |
| | | * 5. nbf -- 在此时间段之前,不会被处理 |
| | | * 6. iat -- jwt发布时间 |
| | | * 7. jti -- jwt唯一标识,防止重复使用 |
| | | * </pre> |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017/8/25 10:59 |
| | | */ |
| | | @Component |
| | | public class JwtTokenUtil { |
| | | |
| | | /** |
| | | * 获取用户名从token中 |
| | | */ |
| | | public static String getUsernameFromToken(String token) { |
| | | return getClaimFromToken(token).getSubject(); |
| | | } |
| | | |
| | | /** |
| | | * 获取jwt发布时间 |
| | | */ |
| | | public static Date getIssuedAtDateFromToken(String token) { |
| | | return getClaimFromToken(token).getIssuedAt(); |
| | | } |
| | | |
| | | /** |
| | | * 获取jwt失效时间 |
| | | */ |
| | | public static Date getExpirationDateFromToken(String token) { |
| | | return getClaimFromToken(token).getExpiration(); |
| | | } |
| | | |
| | | /** |
| | | * 获取jwt接收者 |
| | | */ |
| | | public static String getAudienceFromToken(String token) { |
| | | return getClaimFromToken(token).getAudience(); |
| | | } |
| | | |
| | | /** |
| | | * 获取私有的jwt claim |
| | | */ |
| | | public static String getPrivateClaimFromToken(String token, String key) { |
| | | return getClaimFromToken(token).get(key).toString(); |
| | | } |
| | | |
| | | /** |
| | | * 获取jwt的payload部分 |
| | | */ |
| | | public static Claims getClaimFromToken(String token) { |
| | | return Jwts.parser() |
| | | .setSigningKey(JwtConstants.SECRET) |
| | | .parseClaimsJws(token) |
| | | .getBody(); |
| | | } |
| | | |
| | | /** |
| | | * 解析token是否正确,不正确会报异常<br> |
| | | */ |
| | | public static void parseToken(String token) throws JwtException { |
| | | Jwts.parser().setSigningKey(JwtConstants.SECRET).parseClaimsJws(token).getBody(); |
| | | } |
| | | |
| | | /** |
| | | * <pre> |
| | | * 验证token是否失效 |
| | | * true:过期 false:没过期 |
| | | * </pre> |
| | | */ |
| | | public static Boolean isTokenExpired(String token) { |
| | | try { |
| | | final Date expiration = getExpirationDateFromToken(token); |
| | | return expiration.before(new Date()); |
| | | } catch (ExpiredJwtException expiredJwtException) { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 生成token(通过用户名和签名时候用的随机数) |
| | | */ |
| | | public static String generateToken(String userId) { |
| | | Map<String, Object> claims = new HashMap<>(); |
| | | return doGenerateToken(claims, userId); |
| | | } |
| | | |
| | | /** |
| | | * 生成token |
| | | */ |
| | | private static String doGenerateToken(Map<String, Object> claims, String subject) { |
| | | final Date createdDate = new Date(); |
| | | final Date expirationDate = new Date(createdDate.getTime() + JwtConstants.EXPIRATION * 1000); |
| | | |
| | | return Jwts.builder() |
| | | .setClaims(claims) |
| | | .setSubject(subject) |
| | | .setIssuedAt(createdDate) |
| | | .setExpiration(expirationDate) |
| | | .signWith(SignatureAlgorithm.HS512, JwtConstants.SECRET) |
| | | .compact(); |
| | | } |
| | | |
| | | /** |
| | | * 获取混淆MD5签名用的随机字符串 |
| | | */ |
| | | public static String getRandomKey() { |
| | | return ToolUtil.getRandomString(6); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.core.util; |
| | | |
| | | import com.stylefeng.guns.config.properties.GunsProperties; |
| | | |
| | | /** |
| | | * 验证码工具类 |
| | | */ |
| | | public class KaptchaUtil { |
| | | |
| | | /** |
| | | * 获取验证码开关 |
| | | */ |
| | | public static Boolean getKaptchaOnOff() { |
| | | return SpringContextHolder.getBean(GunsProperties.class).getKaptchaOpen(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.CharteredCar.controller; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.modular.CharteredCar.dto.CharteredCarDto; |
| | | import com.stylefeng.guns.modular.CharteredCar.server.IOrderCharteredCarService; |
| | | import com.stylefeng.guns.modular.system.model.ServerCarModel; |
| | | import com.stylefeng.guns.modular.system.model.TCharteredService; |
| | | import com.stylefeng.guns.modular.system.service.IServerCarModelService; |
| | | import com.stylefeng.guns.modular.system.service.ITCharteredServiceService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("/api/orderCharteredCar") |
| | | public class OrderCharteredCarController { |
| | | |
| | | @Autowired |
| | | private IOrderCharteredCarService orderCharteredCarService; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | @Autowired |
| | | private IServerCarModelService serverCarModelService; |
| | | @Autowired |
| | | private ITCharteredServiceService charteredService; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/list", method = RequestMethod.POST) |
| | | @ApiOperation(value = "根据tag查询包车,全部传-1", tags = {"用户端-包车"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "服务车型id", name = "serverCarModelId", required = true, dataType = "int") |
| | | }) |
| | | public ResultUtil<List<TCharteredService>> list(Integer serverCarModelId){ |
| | | EntityWrapper<TCharteredService> tCharteredServiceEntityWrapper = new EntityWrapper<>(); |
| | | tCharteredServiceEntityWrapper.eq("status",1); |
| | | if (serverCarModelId!=-1){ |
| | | tCharteredServiceEntityWrapper.eq("serverCarModelId",serverCarModelId); |
| | | } |
| | | List<TCharteredService> tCharteredServices = charteredService.selectList(tCharteredServiceEntityWrapper); |
| | | for (TCharteredService tCharteredService : tCharteredServices) { |
| | | ServerCarModel serverCarModel = serverCarModelService.selectById(tCharteredService.getServerCarModelId()); |
| | | if (serverCarModel!=null) { |
| | | tCharteredService.setServerCarModelName(serverCarModel.getName()); |
| | | } |
| | | } |
| | | return ResultUtil.success(tCharteredServices); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/tag", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取包车tag", tags = {"用户端-包车"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<ServerCarModel>> orderCharteredCar(){ |
| | | List<ServerCarModel> serverCarModels = serverCarModelService.selectList(new EntityWrapper<ServerCarModel>().eq("type", 3).eq("state", 1)); |
| | | return ResultUtil.success(serverCarModels); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/orderCharteredCar", method = RequestMethod.POST) |
| | | @ApiOperation(value = "提交包车订单", tags = {"用户端-包车"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil orderCharteredCar(@RequestBody CharteredCarDto charteredCarDto, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | charteredCarDto.setUserId(uid); |
| | | return orderCharteredCarService.createOrder(charteredCarDto); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.CharteredCar.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.CharteredCar.model.OrderCharteredCar; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface OrderCharteredCarMapper extends BaseMapper<OrderCharteredCar> { |
| | | |
| | | |
| | | List<OrderCharteredCar> query(@Param("start") Date start, @Param("end") Date end); |
| | | |
| | | |
| | | /** |
| | | * 获取用户的订单列表 |
| | | * @param uid |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryMyOrderList(@Param("uid") Integer uid, @Param("pageNum") Integer pageNum, |
| | | @Param("size") Integer size); |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.CharteredCar.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.modular.system.model.TCharteredService; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 包车服务 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 吕雪 |
| | | * @since 2020-06-05 |
| | | */ |
| | | public interface TCharteredServiceMapper extends BaseMapper<TCharteredService> { |
| | | |
| | | /** |
| | | * 获取包车管理管理列表 |
| | | * @param page |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param serviceName |
| | | * @param serverCarModelId |
| | | * @param startPrice |
| | | * @param endPrice |
| | | * @param status |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> getCharteredServiceList(@Param("page") Page<Map<String, Object>> page, |
| | | @Param("beginTime")String beginTime, |
| | | @Param("endTime")String endTime, |
| | | @Param("serviceName")String serviceName, |
| | | @Param("serverCarModelId")Integer serverCarModelId, |
| | | @Param("startPrice")BigDecimal startPrice, |
| | | @Param("endPrice")BigDecimal endPrice, |
| | | @Param("status")Integer status); |
| | | |
| | | } |
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.stylefeng.guns.modular.CharteredCar.dao.OrderCharteredCarMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.CharteredCar.model.OrderCharteredCar"> |
| | | <id column="id" property="id"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="companyId" property="companyId"/> |
| | | <result column="orderNumber" property="orderNumber"/> |
| | | <result column="traveltime" property="traveltime"/> |
| | | <result column="carTime" property="carTime"/> |
| | | <result column="serverCarModelId" property="serverCarModelId"/> |
| | | <result column="modelUse" property="modelUse"/> |
| | | <result column="peopleNumber" property="peopleNumber"/> |
| | | <result column="contactPerson" property="contactPerson"/> |
| | | <result column="contactPhone" property="contactPhone"/> |
| | | <result column="state" property="state"/> |
| | | <result column="remark" property="remark"/> |
| | | <result column="isDelete" property="isDelete"/> |
| | | <result column="insertTime" property="insertTime"/> |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | | <select id="query" resultType="OrderCharteredCar"> |
| | | select |
| | | id as id, |
| | | userId as userId, |
| | | companyId as companyId, |
| | | orderNumber as orderNumber, |
| | | traveltime as traveltime, |
| | | carTime as carTime, |
| | | serverCarModelId as serverCarModelId, |
| | | modelUse as modelUse, |
| | | peopleNumber as peopleNumber, |
| | | contactPerson as contactPerson, |
| | | contactPhone as contactPhone, |
| | | state as state, |
| | | remark as remark, |
| | | isDelete as isDelete, |
| | | insertTime as insertTime |
| | | from t_order_chartered_car where isDelete = 1 and insertTime between #{start} and #{end} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryMyOrderList" resultType="map"> |
| | | select |
| | | id as orderId, |
| | | DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i') as orderTime, |
| | | DATE_FORMAT(traveltime, '%Y-%m-%d') as time, |
| | | carTime as carTime, |
| | | (select name from t_server_carmodel where state = 1 and type = 3 and id = a.serverCarModelId) as serverCarModel, |
| | | (6) as orderType, |
| | | state as state |
| | | from t_order_chartered_car as a where userId = #{uid} order by insertTime desc limit #{pageNum}, #{size} |
| | | </select> |
| | | </mapper> |
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.stylefeng.guns.modular.CharteredCar.dao.TCharteredServiceMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.TCharteredService"> |
| | | <id column="id" property="id" /> |
| | | <result column="serviceName" property="serviceName" /> |
| | | <result column="themePicture" property="themePicture" /> |
| | | <result column="serverCarModelId" property="serverCarModelId" /> |
| | | <result column="serviceMoney" property="serviceMoney" /> |
| | | <result column="carType" property="carType" /> |
| | | <result column="status" property="status" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | <result column="insertTime" property="insertTime" /> |
| | | <result column="priceRule" property="priceRule" /> |
| | | <result column="priceRulePicture" property="priceRulePicture" /> |
| | | <result column="cancelRule" property="cancelRule" /> |
| | | <result column="cancelRulePicture" property="cancelRulePicture" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, serviceName, themePicture, serverCarModelId, serviceMoney, carType, status,isDelete,insertTime,priceRule,priceRulePicture,cancelRule,cancelRulePicture |
| | | </sql> |
| | | <select id="getCharteredServiceList" resultType="java.util.Map"> |
| | | select |
| | | tcs.id, tcs.serviceName, tcs.themePicture, tcs.serverCarModelId, tcs.serviceMoney, tcs.carType, tcs.status, |
| | | tcs.isDelete,tcs.insertTime,tcs.priceRule,tcs.priceRulePicture,tcs.cancelRule,tcs.cancelRulePicture,tsc.name serverCarModelName |
| | | from t_chartered_service tcs |
| | | left join t_server_carmodel tsc on tcs.serverCarModelId = tsc.id |
| | | where tcs.isDelete=1 |
| | | <if test="beginTime!=null and endTime!=null and beginTime!='' and endTime!=''"> |
| | | and tcs.insertTime between CONCAT('',#{beginTime},' 00:00:00') and CONCAT('',#{endTime},' 23:59:59') |
| | | </if> |
| | | <if test="serviceName!=null and serviceName!=''"> |
| | | and tcs.serviceName like concat('%',#{serviceName},'%') |
| | | </if> |
| | | <if test="serverCarModelId!=null"> |
| | | and tcs.serverCarModelId=#{serverCarModelId} |
| | | </if> |
| | | <if test="startPrice != null and endPrice != null"> |
| | | and tcs.serviceMoney >= #{startPrice} |
| | | and tcs.serviceMoney <= #{endPrice} |
| | | </if> |
| | | <if test="serverCarModelId!=null"> |
| | | and tcs.serverCarModelId=#{serverCarModelId} |
| | | </if> |
| | | <if test="status!=null"> |
| | | and tcs.status=#{status} |
| | | </if> |
| | | order by tcs.insertTime desc |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | package com.stylefeng.guns.modular.CharteredCar.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | @Data |
| | | public class CharteredCarDto { |
| | | @ApiModelProperty("出行时间") |
| | | private String traveltime; |
| | | @ApiModelProperty("用车时间") |
| | | private double carTime; |
| | | @ApiModelProperty("车型id") |
| | | private Integer serverCarModelId; |
| | | @ApiModelProperty("联系人") |
| | | private String contactPerson; |
| | | @ApiModelProperty("联系人电话") |
| | | private String contactPhone; |
| | | @ApiModelProperty("备注") |
| | | private String newRemark; |
| | | private Integer userId; |
| | | private Double startLon; |
| | | private Double startLat; |
| | | private String startAddress; |
| | | private Double endLon; |
| | | private Double endLat; |
| | | private String endAddress; |
| | | |
| | | private Integer serviceId; |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.CharteredCar.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 包车订单 |
| | | */ |
| | | @TableName("t_order_chartered_car") |
| | | @Data |
| | | public class OrderCharteredCar { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 企业id |
| | | */ |
| | | @TableField("companyId") |
| | | private Integer companyId; |
| | | /** |
| | | * 订单编号 |
| | | */ |
| | | @TableField("orderNumber") |
| | | private String orderNumber; |
| | | /** |
| | | * 出行时间 |
| | | */ |
| | | @TableField("traveltime") |
| | | private Date traveltime; |
| | | /** |
| | | * 用车时长 |
| | | */ |
| | | @TableField("carTime") |
| | | private double carTime; |
| | | /** |
| | | * 车型 |
| | | */ |
| | | @TableField("serverCarModelId") |
| | | private Integer serverCarModelId; |
| | | |
| | | @TableField("serviceId") |
| | | private Integer serviceId; |
| | | /** |
| | | * 车型用途 |
| | | */ |
| | | @TableField("modelUse") |
| | | private String modelUse; |
| | | /** |
| | | * 乘车人数 |
| | | */ |
| | | @TableField("peopleNumber") |
| | | private Integer peopleNumber; |
| | | /** |
| | | * 联系人 |
| | | */ |
| | | @TableField("contactPerson") |
| | | private String contactPerson; |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | @TableField("contactPhone") |
| | | private String contactPhone; |
| | | /** |
| | | * 状态(1=待处理,2=已处理,3=已取消) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @TableField("remark") |
| | | private String remark; |
| | | @TableField("newRemark") |
| | | private String newRemark; |
| | | |
| | | @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; |
| | | /** |
| | | * 删除状态(1=否,2=是) |
| | | */ |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public Integer getCompanyId() { |
| | | return companyId; |
| | | } |
| | | |
| | | public void setCompanyId(Integer companyId) { |
| | | this.companyId = companyId; |
| | | } |
| | | |
| | | public String getOrderNumber() { |
| | | return orderNumber; |
| | | } |
| | | |
| | | public void setOrderNumber(String orderNumber) { |
| | | this.orderNumber = orderNumber; |
| | | } |
| | | |
| | | public Date getTraveltime() { |
| | | return traveltime; |
| | | } |
| | | |
| | | public void setTraveltime(Date traveltime) { |
| | | this.traveltime = traveltime; |
| | | } |
| | | |
| | | |
| | | public void setCarTime(double carTime) { |
| | | this.carTime = carTime; |
| | | } |
| | | |
| | | public Integer getServerCarModelId() { |
| | | return serverCarModelId; |
| | | } |
| | | |
| | | public void setServerCarModelId(Integer serverCarModelId) { |
| | | this.serverCarModelId = serverCarModelId; |
| | | } |
| | | |
| | | public String getModelUse() { |
| | | return modelUse; |
| | | } |
| | | |
| | | public void setModelUse(String modelUse) { |
| | | this.modelUse = modelUse; |
| | | } |
| | | |
| | | public Integer getPeopleNumber() { |
| | | return peopleNumber; |
| | | } |
| | | |
| | | public void setPeopleNumber(Integer peopleNumber) { |
| | | this.peopleNumber = peopleNumber; |
| | | } |
| | | |
| | | public String getContactPerson() { |
| | | return contactPerson; |
| | | } |
| | | |
| | | public void setContactPerson(String contactPerson) { |
| | | this.contactPerson = contactPerson; |
| | | } |
| | | |
| | | public String getContactPhone() { |
| | | return contactPhone; |
| | | } |
| | | |
| | | public void setContactPhone(String contactPhone) { |
| | | this.contactPhone = contactPhone; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public Integer getIsDelete() { |
| | | return isDelete; |
| | | } |
| | | |
| | | public void setIsDelete(Integer isDelete) { |
| | | this.isDelete = isDelete; |
| | | } |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "OrderCharteredCar{" + |
| | | "id=" + id + |
| | | ", userId=" + userId + |
| | | ", companyId=" + companyId + |
| | | ", orderNumber='" + orderNumber + '\'' + |
| | | ", traveltime=" + traveltime + |
| | | ", carTime=" + carTime + |
| | | ", serverCarModelId=" + serverCarModelId + |
| | | ", modelUse='" + modelUse + '\'' + |
| | | ", peopleNumber=" + peopleNumber + |
| | | ", contactPerson='" + contactPerson + '\'' + |
| | | ", contactPhone='" + contactPhone + '\'' + |
| | | ", state=" + state + |
| | | ", remark='" + remark + '\'' + |
| | | ", isDelete=" + isDelete + |
| | | ", insertTime=" + insertTime + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.CharteredCar.server; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.CharteredCar.dto.CharteredCarDto; |
| | | import com.stylefeng.guns.modular.CharteredCar.model.OrderCharteredCar; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface IOrderCharteredCarService extends IService<OrderCharteredCar> { |
| | | |
| | | |
| | | /** |
| | | * 下单 |
| | | * @param traveltime |
| | | * @param carTime |
| | | * @param serverCarModelId |
| | | * @param modelUse |
| | | * @param peopleNumber |
| | | * @param contactPerson |
| | | * @param contactPhone |
| | | * @param placeLonLat |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil orderCharteredCar(Date travelTime, Integer carTime, Integer serverCarModelId, String modelUse, Integer peopleNumber, |
| | | String contactPerson, String contactPhone, String placeLonLat, Integer uid) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取用户的订单列表 |
| | | * @param uid |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryMyOrderList(Integer uid, Integer pageNum, Integer size) throws Exception; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加取消 |
| | | * @param id |
| | | * @param reason |
| | | * @param remark |
| | | * @param uid |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil addCancle(Integer id, String reason, String remark, Integer uid) throws Exception; |
| | | |
| | | |
| | | ResultUtil createOrder(CharteredCarDto charteredCarDto); |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.CharteredCar.server.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.CharteredCar.dao.OrderCharteredCarMapper; |
| | | import com.stylefeng.guns.modular.CharteredCar.dto.CharteredCarDto; |
| | | import com.stylefeng.guns.modular.CharteredCar.model.OrderCharteredCar; |
| | | import com.stylefeng.guns.modular.CharteredCar.server.IOrderCharteredCarService; |
| | | import com.stylefeng.guns.modular.system.dao.SensitiveWordsMapper; |
| | | import com.stylefeng.guns.modular.system.model.Company; |
| | | import com.stylefeng.guns.modular.system.model.OrderCancel; |
| | | import com.stylefeng.guns.modular.system.model.SensitiveWords; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.service.ICompanyCityService; |
| | | import com.stylefeng.guns.modular.system.service.IOrderCancelService; |
| | | import com.stylefeng.guns.modular.system.service.ISystemNoticeService; |
| | | import com.stylefeng.guns.modular.system.util.DateUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @Service |
| | | public class OrderCharteredCarServiceImpl extends ServiceImpl<OrderCharteredCarMapper, OrderCharteredCar> implements IOrderCharteredCarService { |
| | | |
| | | @Resource |
| | | private OrderCharteredCarMapper orderCharteredCarMapper; |
| | | |
| | | @Resource |
| | | private SensitiveWordsMapper sensitiveWordsMapper; |
| | | |
| | | @Autowired |
| | | private ICompanyCityService companyCityService; |
| | | |
| | | @Autowired |
| | | private DateUtil dateUtil; |
| | | |
| | | @Autowired |
| | | private IOrderCancelService orderCancelService; |
| | | |
| | | @Autowired |
| | | private ISystemNoticeService systemNoticeService; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存数据 |
| | | * @param traveltime |
| | | * @param carTime |
| | | * @param modelUse |
| | | * @param peopleNumber |
| | | * @param contactPerson |
| | | * @param contactPhone |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil orderCharteredCar(Date travelTime, Integer carTime, Integer serverCarModelId, String modelUse, Integer peopleNumber, |
| | | String contactPerson, String contactPhone, String placeLonLat, Integer uid) throws Exception { |
| | | OrderCharteredCar orderCharteredCar = new OrderCharteredCar(); |
| | | orderCharteredCar.setUserId(uid); |
| | | Company query = companyCityService.query(placeLonLat.split(",")[0], placeLonLat.split(",")[1]); |
| | | if(null == query){ |
| | | return ResultUtil.error("该地点暂无企业服务"); |
| | | } |
| | | orderCharteredCar.setCompanyId(query.getId()); |
| | | orderCharteredCar.setOrderNumber(this.getOrderNum()); |
| | | orderCharteredCar.setTraveltime(travelTime); |
| | | orderCharteredCar.setCarTime(carTime); |
| | | orderCharteredCar.setServerCarModelId(serverCarModelId); |
| | | orderCharteredCar.setModelUse(modelUse); |
| | | orderCharteredCar.setPeopleNumber(peopleNumber); |
| | | orderCharteredCar.setContactPerson(contactPerson); |
| | | orderCharteredCar.setContactPhone(contactPhone); |
| | | orderCharteredCar.setState(1); |
| | | orderCharteredCar.setIsDelete(1); |
| | | orderCharteredCar.setInsertTime(new Date()); |
| | | this.insert(orderCharteredCar); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取个人中心订单列表 |
| | | * @param uid |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryMyOrderList(Integer uid, Integer pageNum, Integer size) throws Exception { |
| | | pageNum = (pageNum - 1) * size; |
| | | List<Map<String, Object>> maps = orderCharteredCarMapper.queryMyOrderList(uid, pageNum, size); |
| | | return maps; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public ResultUtil addCancle(Integer id, String reason, String remark, Integer uid) throws Exception { |
| | | if(ToolUtil.isNotEmpty(remark)){ |
| | | if(ToolUtil.isNotEmpty(remark)){ |
| | | List<SensitiveWords> sensitiveWords = sensitiveWordsMapper.selectList(null); |
| | | for(SensitiveWords s : sensitiveWords){ |
| | | remark = remark.replaceAll(s.getContent(), "***"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | OrderCharteredCar orderCharteredCar = this.selectById(id); |
| | | if(null == orderCharteredCar){ |
| | | return ResultUtil.error("取消订单失败,订单信息有误"); |
| | | } |
| | | if(orderCharteredCar.getState() != 1){ |
| | | return ResultUtil.error("取消订单失败,不合法的操作"); |
| | | } |
| | | |
| | | OrderCancel orderCancel = new OrderCancel(); |
| | | orderCancel.setOrderId(id); |
| | | orderCancel.setOrderType(6); |
| | | orderCancel.setReason(reason); |
| | | orderCancel.setRemark(remark); |
| | | orderCancel.setState(2); |
| | | orderCancel.setInsertTime(new Date()); |
| | | orderCancel.setUserType(1); |
| | | orderCancelService.insert(orderCancel); |
| | | orderCharteredCar.setState(3); |
| | | this.updateById(orderCharteredCar); |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, "您已成功取消旅游包车订单,谢谢使用!", orderCharteredCar.getUserId(), 1); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", orderCancel.getId()); |
| | | return ResultUtil.success(map); |
| | | } |
| | | |
| | | @Override |
| | | public ResultUtil createOrder(CharteredCarDto charteredCarDto) { |
| | | OrderCharteredCar orderCharteredCar = new OrderCharteredCar(); |
| | | BeanUtils.copyProperties(charteredCarDto,orderCharteredCar); |
| | | try { |
| | | orderCharteredCar.setOrderNumber(this.getOrderNum()); |
| | | orderCharteredCar.setCompanyId(1); |
| | | orderCharteredCar.setIsDelete(1); |
| | | orderCharteredCar.setState(1); |
| | | orderCharteredCar.setInsertTime(new Date()); |
| | | orderCharteredCar.setCarTime(charteredCarDto.getCarTime()); |
| | | |
| | | String strDateTime = charteredCarDto.getTraveltime(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-M-d H:m"); |
| | | |
| | | try { |
| | | Date date = sdf.parse(strDateTime); |
| | | System.out.println("Converted Date and Time: " + date); |
| | | orderCharteredCar.setTraveltime(date); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | this.insert(orderCharteredCar); |
| | | return ResultUtil.success(); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | public synchronized String getOrderNum() throws Exception{ |
| | | int size = this.selectCount(null); |
| | | return "CHARTERED" + String.valueOf(1000000 + size + 1).substring(1); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.stylefeng.guns.modular.system.service.IAdvertisementService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.AdvertisementWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 广告控制器 |
| | | */ |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("/base/advertisement") |
| | | public class AdvertisementController { |
| | | |
| | | @Autowired |
| | | private IAdvertisementService advertisementService; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/queryByType") |
| | | @ApiOperation(value = "获取广告列表", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "数据类型(1:弹窗广告,2:底部广告)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "当前定位城市code(510100)", name = "code", required = true, dataType = "string") |
| | | }) |
| | | public ResultUtil<List<AdvertisementWarpper>> queryAdvertisement(String code, Integer type){ |
| | | try { |
| | | List<AdvertisementWarpper> advertisementWarpper = advertisementService.queryAdvertisement(code, type); |
| | | return ResultUtil.success(advertisementWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.stylefeng.guns.modular.system.service.IAgreementService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * 协议控制器 |
| | | */ |
| | | @Api |
| | | @RestController |
| | | //@CrossOrigin |
| | | @RequestMapping("/base/agreement") |
| | | public class AgreementController { |
| | | |
| | | @Autowired |
| | | private IAgreementService agreementService; |
| | | |
| | | |
| | | /** |
| | | * 获取各种协议 |
| | | * @param type |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryByType") |
| | | @ApiOperation(value = "获取各种协议及H5页面", tags = {"用户端-协议"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "数据类型(1:隐私协议,2:用户协议,3:用户指南,4:法律条款,5:关于我们,6=注册协议,7=取消订单说明,8=充值领券规则设置,9=司机注册协议,10=改派说明,11=跨城出行乘车须知,12:常见问题,13:计价规则,14:包车协议)", name = "type", required = true, dataType = "int") |
| | | }) |
| | | public ResultUtil<BaseWarpper> queryByType(Integer type){ |
| | | try { |
| | | String s = agreementService.queryByType(type); |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setContent(s); |
| | | return ResultUtil.success(baseWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.base.tips.ErrorTip; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.JwtTokenUtil; |
| | | import com.stylefeng.guns.modular.system.dao.UserMapper; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import org.apache.shiro.authc.SimpleAuthenticationInfo; |
| | | import org.apache.shiro.authc.UsernamePasswordToken; |
| | | import org.apache.shiro.authc.credential.HashedCredentialsMatcher; |
| | | import org.apache.shiro.crypto.hash.Md5Hash; |
| | | import org.apache.shiro.util.ByteSource; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | | * 接口控制器提供 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2018/7/20 23:39 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/gunsApi") |
| | | public class ApiController extends BaseController { |
| | | |
| | | @Autowired |
| | | private UserMapper userMapper; |
| | | |
| | | /** |
| | | * api登录接口,通过账号密码获取token |
| | | */ |
| | | @RequestMapping("/auth") |
| | | public Object auth(@RequestParam("username") String username, |
| | | @RequestParam("password") String password) { |
| | | |
| | | //封装请求账号密码为shiro可验证的token |
| | | UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(username, password.toCharArray()); |
| | | |
| | | //获取数据库中的账号密码,准备比对 |
| | | User user = userMapper.getByAccount(username); |
| | | |
| | | String credentials = user.getPassword(); |
| | | String salt = user.getSalt(); |
| | | ByteSource credentialsSalt = new Md5Hash(salt); |
| | | SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo( |
| | | new ShiroUser(), credentials, credentialsSalt, ""); |
| | | |
| | | //校验用户账号密码 |
| | | HashedCredentialsMatcher md5CredentialsMatcher = new HashedCredentialsMatcher(); |
| | | md5CredentialsMatcher.setHashAlgorithmName(ShiroKit.hashAlgorithmName); |
| | | md5CredentialsMatcher.setHashIterations(ShiroKit.hashIterations); |
| | | boolean passwordTrueFlag = md5CredentialsMatcher.doCredentialsMatch( |
| | | usernamePasswordToken, simpleAuthenticationInfo); |
| | | |
| | | if (passwordTrueFlag) { |
| | | HashMap<String, Object> result = new HashMap<>(); |
| | | result.put("token", JwtTokenUtil.generateToken(String.valueOf(user.getId()))); |
| | | return result; |
| | | } else { |
| | | return new ErrorTip(500, "账号密码错误!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 测试接口是否走鉴权 |
| | | */ |
| | | @RequestMapping(value = "/test", method = RequestMethod.POST) |
| | | public Object test() { |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.stylefeng.guns.modular.system.service.IUserCouponRecordService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.CouponWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import sun.security.provider.MD5; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Base64; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 优惠券控制器 |
| | | */ |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class CouponController { |
| | | |
| | | @Autowired |
| | | private IUserCouponRecordService userCouponRecordService; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | |
| | | /** |
| | | * 获取个人优惠券列表 |
| | | * @param state |
| | | * @param pageNum |
| | | * @param size |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/coupon/queryMyCoupons") |
| | | @ApiOperation(value = "获取个人优惠券列表", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "优惠券状态(1=未使用,2=已使用)", name = "state", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页码(首页1)", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<CouponWarpper>> queryMyCoupons(Integer state, Integer pageNum, Integer size, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<Map<String, Object>> list = userCouponRecordService.queryMyCoupons(state, pageNum, size, uid); |
| | | return ResultUtil.success(CouponWarpper.getCouponWarppers(list)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/coupon/queryUserCoupons") |
| | | @ApiOperation(value = "获取用户优惠券列表", tags = {"道行龙城"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "用户id", name = "userId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "优惠券状态(1=未使用,2=已使用)", name = "state", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页码(首页1)", name = "pageNo", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "pageSize", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "签名", name = "sign", required = true, dataType = "string"), |
| | | }) |
| | | public ResultUtil<List<CouponWarpper>> queryUserCoupons(@RequestParam Integer userId, @RequestParam Integer state, @RequestParam Integer pageNo, |
| | | @RequestParam Integer pageSize, @RequestParam String sign){ |
| | | try { |
| | | List<Map<String, Object>> list = userCouponRecordService.queryMyCoupons(state, pageNo, pageSize, userId); |
| | | return ResultUtil.success(CouponWarpper.getCouponWarppers(list)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 删除优惠券 |
| | | * @param id |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/coupon/delMyCoupon") |
| | | @ApiOperation(value = "删除优惠券", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "优惠券id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil delMyCoupon(Integer id, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return userCouponRecordService.delMyCoupon(id, uid); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 赠送优惠券 |
| | | * @param id |
| | | * @param userId |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/coupon/handselCoupon") |
| | | @ApiOperation(value = "赠送优惠券", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "优惠券id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "赠送用户id", name = "userId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil handselCoupon(Integer id, Integer userId, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return userCouponRecordService.handselCoupon(id, uid, userId); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.service.IDriverService; |
| | | import com.stylefeng.guns.modular.system.service.IOrderEvaluateService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.DriverInfoWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.OrderEvaluateWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 司机控制器 |
| | | */ |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class DriverController { |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Autowired |
| | | private IOrderEvaluateService orderEvaluateService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取5公里范围内空闲司机数量 |
| | | * @param type 业务类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车) |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/queryIdleDriver") |
| | | @ApiOperation(value = "获取5公里范围内空闲司机数量", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "业务类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车 7=接送机)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "乘客当前定位经度", name = "lon", required = true, dataType = "double"), |
| | | @ApiImplicitParam(value = "乘客当前定位纬度", name = "lat", required = true, dataType = "double") |
| | | }) |
| | | public ResultUtil<BaseWarpper> queryIdleDriver(Integer type, Double lon, Double lat){ |
| | | try { |
| | | List<Driver> list = driverService.queryIdleDriver(type, lon, lat, 5D, null); |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setNumber(list.size()); |
| | | return ResultUtil.success(baseWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取司机详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/queryDriverInfo") |
| | | @ApiOperation(value = "获取司机详情", tags = {"用户端-订单相关"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "司机id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<DriverInfoWarpper> queryDriverInfo(Integer id){ |
| | | try { |
| | | Map<String, Object> map = driverService.queryDriverInfo(id); |
| | | String name = String.valueOf(map.get("name")); |
| | | map.put("name", name.substring(0, 1) + "师傅"); |
| | | List<BaseWarpper> list = driverService.queryBusiness(id); |
| | | map.put("list", list); |
| | | return ResultUtil.success(DriverInfoWarpper.getDriverInfoWarpper(map)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取司机的历史评价 |
| | | * @param id |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryOrderEvaluate") |
| | | @ApiOperation(value = "获取司机的历史评价", tags = {"用户端-订单相关"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "司机id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<OrderEvaluateWarpper>> queryOrderEvaluate(Integer id, Integer pageNum, Integer size){ |
| | | try { |
| | | List<Map<String, Object>> list = orderEvaluateService.queryOrderEvaluate(id, pageNum, size); |
| | | return ResultUtil.success(OrderEvaluateWarpper.getOrderEvaluateWarpper(list)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.stylefeng.guns.modular.system.service.IFeedbackService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | /** |
| | | * 反馈控制器 |
| | | */ |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("/api/feedback") |
| | | public class FeedbackController { |
| | | |
| | | @Autowired |
| | | private IFeedbackService feedbackService; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | |
| | | /** |
| | | * 提交反馈意见 |
| | | * @param content |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/feedback") |
| | | @ApiOperation(value = "提交反馈意见", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "反馈内容", name = "content", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil feedback(String content, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(uid == null){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return feedbackService.feedback(content, uid); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.modular.system.model.FrequentPassengers; |
| | | import com.stylefeng.guns.modular.system.service.IFrequentPassengersService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.JuHeUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 常用乘车人 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/base/frequentPassengers") |
| | | public class FrequentPassengersController { |
| | | |
| | | @Autowired |
| | | private IFrequentPassengersService frequentPassengersService; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | @Autowired |
| | | private JuHeUtil juHeUtil; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/saveFrequentPassengers", method = RequestMethod.POST) |
| | | @ApiOperation(value = "添加/编辑 常用乘车人【新】", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil saveFrequentPassengers(FrequentPassengers frequentPassengers, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | //开始校验身份真实 |
| | | boolean b = juHeUtil.idcard(frequentPassengers.getName(), frequentPassengers.getIdcode()); |
| | | if(!b){ |
| | | return ResultUtil.error("身份校验不通过"); |
| | | } |
| | | // FrequentPassengers frequentPassengers1 = frequentPassengersService.selectOne(new EntityWrapper<FrequentPassengers>().eq("userId", uid).eq("phone", frequentPassengers.getPhone()).eq("status", 1)); |
| | | // if(null != frequentPassengers1){ |
| | | // return ResultUtil.error("该手机号已被使用"); |
| | | // } |
| | | FrequentPassengers frequentPassengers1 = frequentPassengersService.selectOne(new EntityWrapper<FrequentPassengers>().eq("userId", uid).eq("idcode", frequentPassengers.getIdcode()).eq("status", 1)); |
| | | if(null != frequentPassengers1){ |
| | | if(null == frequentPassengers.getId()){ |
| | | return ResultUtil.error("该身份证号已被使用"); |
| | | } |
| | | if(null != frequentPassengers.getId() && frequentPassengers1.getId().compareTo(frequentPassengers.getId()) != 0){ |
| | | return ResultUtil.error("该身份证号已被使用"); |
| | | } |
| | | } |
| | | |
| | | frequentPassengers.setUserId(uid); |
| | | frequentPassengers.setStatus(1); |
| | | frequentPassengers.setCreateTime(new Date()); |
| | | if(null == frequentPassengers.getId()){ |
| | | frequentPassengersService.insert(frequentPassengers); |
| | | }else{ |
| | | frequentPassengersService.updateById(frequentPassengers); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/queryFrequentPassengersList", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取常用乘车人列表【新】", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<FrequentPassengers>> queryFrequentPassengersList(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<FrequentPassengers> frequentPassengers = frequentPassengersService.selectList(new EntityWrapper<FrequentPassengers>().eq("userId", uid).eq("status", 1)); |
| | | return ResultUtil.success(frequentPassengers); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/delFrequentPassengers", method = RequestMethod.POST) |
| | | @ApiOperation(value = "删除常用乘车人列表【新】", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "数据id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil delFrequentPassengers(Integer id, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | FrequentPassengers frequentPassengers = frequentPassengersService.selectOne(new EntityWrapper<FrequentPassengers>().eq("id", id).eq("userId", uid)); |
| | | if(null == frequentPassengers){ |
| | | return ResultUtil.error("无效的数据"); |
| | | } |
| | | frequentPassengers.setStatus(3); |
| | | frequentPassengersService.updateById(frequentPassengers); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | |
| | | import com.stylefeng.guns.modular.system.model.IntegralOrder; |
| | | import com.stylefeng.guns.modular.system.service.IIntegralGoodsService; |
| | | import com.stylefeng.guns.modular.system.service.IIntegralOrderService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.IntegralGoodsWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.IntegralOrderWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("/api/integralGoods") |
| | | public class IntegralGoodsController { |
| | | |
| | | @Autowired |
| | | private IIntegralGoodsService integralGoodsService; |
| | | |
| | | @Autowired |
| | | private IIntegralOrderService integralOrderService; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取积分兑换的商品 |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryGoods") |
| | | @ApiOperation(value = "获取积分兑换的商品", tags = {"用户端-积分相关"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<IntegralGoodsWarpper>> queryGoods(Integer pageNum, Integer size){ |
| | | try { |
| | | List<Map<String, Object>> list = integralGoodsService.queryGoods(pageNum, size); |
| | | return ResultUtil.success(IntegralGoodsWarpper.getIntegralGoodsWarppers(list)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取商品详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryGoodsInfo") |
| | | @ApiOperation(value = "获取商品详情", tags = {"用户端-积分相关"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "商品id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil queryGoodsInfo(Integer id){ |
| | | try { |
| | | Map<String, Object> map = integralGoodsService.queryGoodsInfo(id); |
| | | return ResultUtil.success(IntegralGoodsWarpper.getIntegralGoodsWarpper(map)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 兑换商品 |
| | | * @param integralOrder |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/addIntegralOrder") |
| | | @ApiOperation(value = "兑换商品", tags = {"用户端-积分相关"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "商品id", name = "goodsId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "收件人", name = "consigneeName", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "收件人电话", name = "consigneePhone", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "收货地址", name = "consigneeAddress", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "备注", name = "remark", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil addIntegralOrder(IntegralOrder integralOrder, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return integralOrderService.addIntegralOrder(integralOrder, uid); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/queryConvertHistory") |
| | | @ApiOperation(value = "获取兑换历史记录", tags = {"用户端-积分相关"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<IntegralOrderWarpper>> queryConvertHistory(Integer pageNum, Integer size, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<Map<String, Object>> list = integralOrderService.queryConvertHistory(pageNum, size, uid); |
| | | return ResultUtil.success(IntegralOrderWarpper.getIntegralOrderWarppers(list)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.stylefeng.guns.modular.system.model.Invoice; |
| | | import com.stylefeng.guns.modular.system.service.IInvoiceService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.InvoiceWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 发票控制器 |
| | | */ |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("/api/invoice") |
| | | public class InvoiceController { |
| | | |
| | | @Autowired |
| | | private IInvoiceService invoiceService; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 开票操作 |
| | | * @param invoice |
| | | * @param order |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/invoicing") |
| | | @ApiOperation(value = "开发票操作", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "开票订单数据([{\"type\":1,\"id\":12345}])分别为订单类型(1=专车,2=出租车,3=跨城出行,4=同城小件物流),5=跨城小件物流和订单id", name = "order", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "开票类型(1=个人发票,2=单位发票)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "抬头名称(公司名字/个人姓名)", name = "name", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "税号", name = "code", required = false, dataType = "string"), |
| | | @ApiImplicitParam(value = "发票内容", name = "content", required = false, dataType = "string"), |
| | | @ApiImplicitParam(value = "备注", name = "remark", required = false, dataType = "string"), |
| | | @ApiImplicitParam(value = "地址+电话", name = "address", required = false, dataType = "string"), |
| | | @ApiImplicitParam(value = "开户行+账号", name = "bank", required = false, dataType = "string"), |
| | | @ApiImplicitParam(value = "邮箱地址", name = "email", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil invoicing(Invoice invoice, String order, HttpServletRequest request){ |
| | | try { |
| | | |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | invoiceService.invoicing(invoice, order, uid); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取开票历史 |
| | | * @param pageNum |
| | | * @param size |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryMyInvoice") |
| | | @ApiOperation(value = "获取开票历史", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "inr"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<InvoiceWarpper>> queryMyInvoice(Integer pageNum, Integer size, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<Map<String, Object>> maps = invoiceService.queryMyInvoice(pageNum, size, uid); |
| | | return ResultUtil.success(InvoiceWarpper.getInvoiceWarpper(maps)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | |
| | | import com.stylefeng.guns.modular.system.util.MinistryOfTransport; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | |
| | | /** |
| | | * 交通部测试接口 |
| | | */ |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("/base/ministryOfTransport") |
| | | public class MinistryOfTransportController { |
| | | |
| | | @Autowired |
| | | private MinistryOfTransport ministryOfTransport; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @ApiOperation(value = "上传企业基础信息", tags = {"交通部测试接口"}) |
| | | @RequestMapping(value = "/pushCompany", method = RequestMethod.POST) |
| | | public void pushCompany() { |
| | | try { |
| | | ministryOfTransport.baseInfoCompany(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.stylefeng.guns.modular.system.service.INettyService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.EndPushWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.OrderServerWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.OrderStatusWarpper; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 仿Socket控制器 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/api/netty") |
| | | public class NettyController { |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | @Autowired |
| | | private INettyService nettyService; |
| | | |
| | | |
| | | /** |
| | | * 获取没有司机接单的提醒数据 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryEndPush") |
| | | @ApiOperation(value = "获取没有司机接单的提醒数据", tags = {"用户端-仿socket接口"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,4=小件物流-同城,5=小件物流-跨城,6=包车,7=接送机)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<EndPushWarpper> queryEndPush(Integer orderId, Integer orderType, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return nettyService.queryEndPush(orderId, orderType, uid); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取服务中的及时数据 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryOrderServer") |
| | | @ApiOperation(value = "获取服务中的及时数据", tags = {"用户端-仿socket接口"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车,7=接送机)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<OrderServerWarpper> queryOrderServer(Integer orderId, Integer orderType, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return nettyService.queryOrderServer(orderId, orderType, uid); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | |
| | | import com.stylefeng.guns.modular.system.service.IOpenCityBusinessService; |
| | | import com.stylefeng.guns.modular.system.service.IOpenCityService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 开通城市控制器 |
| | | */ |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("/base/openCity") |
| | | public class OpenCityController { |
| | | |
| | | @Autowired |
| | | private IOpenCityService openCityService; |
| | | |
| | | @Autowired |
| | | private IOpenCityBusinessService openCityBusinessService; |
| | | |
| | | |
| | | /** |
| | | * 获取开通城市列表 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryOpenCity") |
| | | @ApiOperation(value = "获取开通城市列表", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResultUtil<List<BaseWarpper>> queryOpenCity(){ |
| | | try { |
| | | List<BaseWarpper> list = openCityService.queryOpenCity(); |
| | | return ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据当前定位获取对应的业务类型 |
| | | * @param province |
| | | * @param city |
| | | * @param district |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryBusiness") |
| | | @ApiOperation(value = "根据当前定位获取业务类型", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "省名称", name = "province", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "市名称", name = "city", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "区县名称", name = "district", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil<List<BaseWarpper>> queryBusiness(String province, String city, String district){ |
| | | try { |
| | | List<BaseWarpper> list = openCityBusinessService.queryBusiness(province, city, district); |
| | | return ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据开通城市id获取业务类型 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryBusinessById") |
| | | @ApiOperation(value = "选择开通城市获取业务类型", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "开通城市id", name = "id", required = true, dataType = "int") |
| | | }) |
| | | public ResultUtil<List<BaseWarpper>> queryBusinessById(Integer id){ |
| | | try { |
| | | List<BaseWarpper> list = openCityBusinessService.queryBusinessById(id); |
| | | return ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断开通城市 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/openCity") |
| | | @ApiOperation(value = "判断当前是否是开通城市", tags = {"用户端-首页"}, notes = "open=1(是),open=2(否)") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "当前定位城市code", name = "code", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil openCity(String code){ |
| | | try { |
| | | boolean b = openCityService.openCity(code); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("open", b ? 1 : 2); |
| | | return ResultUtil.success(map); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.CharteredCar.server.IOrderCharteredCarService; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.TActivityGeneralization; |
| | | import com.stylefeng.guns.modular.system.model.UserCouponRecord; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.warpper.*; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.model.TransactionDetails; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import com.stylefeng.guns.modular.taxi.service.ITransactionDetailsService; |
| | | import com.stylefeng.guns.modular.transfer.model.OrderTransferCar; |
| | | import com.stylefeng.guns.modular.transfer.server.IOrderTransferService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 订单控制器(综合) |
| | | */ |
| | | @Api |
| | | //@CrossOrigin |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class OrderController { |
| | | |
| | | @Autowired |
| | | private IOrderTaxiService orderTaxiService; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | @Autowired |
| | | private IOrderPositionService orderPositionService; |
| | | |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | | |
| | | @Autowired |
| | | private IOrderService orderService; |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Autowired |
| | | private WeChatUtil weChatUtil; |
| | | |
| | | @Autowired |
| | | private IOrderPrivateCarService orderPrivateCarService; |
| | | |
| | | @Autowired |
| | | private IComplaintService complaintService; |
| | | |
| | | @Autowired |
| | | private IOrderEvaluateService orderEvaluateService; |
| | | |
| | | @Autowired |
| | | private IOrderCrossCityService orderCrossCityService; |
| | | |
| | | // @Autowired |
| | | // private ICBCPayUtil icbcPayUtil; |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | | @Autowired |
| | | private IOrderCharteredCarService orderCharteredCarService; |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | |
| | | @Autowired |
| | | private ITransactionDetailsService transactionDetailsService; |
| | | |
| | | @Autowired |
| | | private IOrderCancelService orderCancelService; |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | | |
| | | @Autowired |
| | | private IOrderTransferService orderTransferService; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取正在进行中的订单 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryServingOrder") |
| | | @ApiOperation(value = "获取正在进行中的订单", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<OrderStatusWarpper>> queryServingOrder(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<OrderStatusWarpper> data = new ArrayList<>(); |
| | | List<OrderPrivateCar> orderPrivateCars = orderPrivateCarService.queryOrder(uid, 1, 2, 3, 4, 5, 6, 7, 11, 12); |
| | | for(OrderPrivateCar orderPrivateCar : orderPrivateCars){ |
| | | if(orderPrivateCar.getState() == 11){ |
| | | orderPrivateCar.setState(orderPrivateCar.getOldState()); |
| | | } |
| | | OrderStatusWarpper orderStatusWarpper = new OrderStatusWarpper(); |
| | | orderStatusWarpper.setOrderId(orderPrivateCar.getId()); |
| | | orderStatusWarpper.setOrderType(1); |
| | | orderStatusWarpper.setState(orderPrivateCar.getState()); |
| | | data.add(orderStatusWarpper); |
| | | } |
| | | |
| | | List<OrderTransferCar> orderTransferCars = orderTransferService.queryOrder(uid, 1, 2, 3, 4, 5, 6, 7, 11, 12); |
| | | for(OrderTransferCar orderPrivateCar : orderTransferCars){ |
| | | if(orderPrivateCar.getState() == 11){ |
| | | orderPrivateCar.setState(orderPrivateCar.getOldState()); |
| | | } |
| | | OrderStatusWarpper orderStatusWarpper = new OrderStatusWarpper(); |
| | | orderStatusWarpper.setOrderId(orderPrivateCar.getId()); |
| | | orderStatusWarpper.setOrderType(7); |
| | | orderStatusWarpper.setState(orderPrivateCar.getState()); |
| | | data.add(orderStatusWarpper); |
| | | } |
| | | |
| | | List<OrderTaxi> list = orderTaxiService.queryOrder(uid, 1, 2, 3, 4, 5, 6, 7, 11, 12); |
| | | for(OrderTaxi orderTaxi : list){ |
| | | if(orderTaxi.getState() == 11){ |
| | | orderTaxi.setState(orderTaxi.getOldState()); |
| | | } |
| | | OrderStatusWarpper orderStatusWarpper = new OrderStatusWarpper(); |
| | | orderStatusWarpper.setOrderId(orderTaxi.getId()); |
| | | orderStatusWarpper.setOrderType(2); |
| | | orderStatusWarpper.setState(orderTaxi.getState()); |
| | | data.add(orderStatusWarpper); |
| | | } |
| | | List<OrderCrossCity> orderCrossCities = orderCrossCityService.queryOrder(uid, 1, 2, 3, 4, 5, 6, 7, 11, 12); |
| | | for(OrderCrossCity orderCrossCity : orderCrossCities){ |
| | | if(orderCrossCity.getState() == 11){ |
| | | orderCrossCity.setState(orderCrossCity.getOldState()); |
| | | } |
| | | OrderStatusWarpper orderStatusWarpper = new OrderStatusWarpper(); |
| | | orderStatusWarpper.setOrderId(orderCrossCity.getId()); |
| | | orderStatusWarpper.setOrderType(3); |
| | | orderStatusWarpper.setState(orderCrossCity.getState()); |
| | | data.add(orderStatusWarpper); |
| | | } |
| | | return ResultUtil.success(data); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取个人中心订单列表 |
| | | * @param type |
| | | * @param pageNum |
| | | * @param size |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryMyOrderList") |
| | | @ApiOperation(value = "获取个人中心订单列表", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城出行,4=小件物流,5=包车,7接送机)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页码(首页1)", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<OrderWarpper>> queryMyOrderList(Integer type, Integer pageNum, Integer size, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<Map<String, Object>> list = null; |
| | | switch (type){ |
| | | case 1: |
| | | list = orderPrivateCarService.queryMyOrderList(uid, pageNum, size); |
| | | break; |
| | | case 2: |
| | | list = orderTaxiService.queryMyOrderList(uid, pageNum, size); |
| | | break; |
| | | case 3: |
| | | list = orderCrossCityService.queryMyOrderList(uid, pageNum, size); |
| | | break; |
| | | case 4: |
| | | list = orderLogisticsService.queryMyOrderList(uid, pageNum, size); |
| | | break; |
| | | case 5: |
| | | list = orderCharteredCarService.queryMyOrderList(uid, pageNum, size); |
| | | break; |
| | | case 7: |
| | | list = orderTransferService.queryMyOrderList(uid, pageNum, size); |
| | | break; |
| | | } |
| | | return ResultUtil.success(OrderWarpper.getOrderWarpper(list)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取消费记录 |
| | | * @param pageNum |
| | | * @param size |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryMyTravelRecord") |
| | | @ApiOperation(value = "获取消费记录", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码(首页1)", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<TravelRecordWarpper>> queryMyTravelRecord(Integer pageNum, Integer size, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Integer page = pageNum; |
| | | pageNum = (pageNum - 1) * size; |
| | | List<Map<String, Object>> maps = orderCancelService.queryCancel(uid, 2); |
| | | List<Map<String, Object>> list = orderPrivateCarService.queryMyTravelRecord(uid);//专车 |
| | | List<Map<String, Object>> list1 = orderTaxiService.queryMyTravelRecord(uid);//出租车 |
| | | List<Map<String, Object>> list2 = orderCrossCityService.queryMyTravelRecord(uid);//跨城车 |
| | | List<Map<String, Object>> list3 = orderLogisticsService.queryMyTravelRecord(uid);//小件物流 |
| | | List<TransactionDetails> transactionDetails = transactionDetailsService.selectList(new EntityWrapper<TransactionDetails>().eq("state", 1) |
| | | .eq("type", 1).eq("userType", 1).eq("userId", uid)); |
| | | List<Map<String, Object>> list4 = new ArrayList<>(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | for(TransactionDetails transactionDetails1 : transactionDetails){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("money", transactionDetails1.getMoney()); |
| | | map.put("time", sdf.format(transactionDetails1.getInsertTime())); |
| | | map.put("name", transactionDetails1.getOrderType() == 3 ? "跨城订单取消退款" : transactionDetails1.getOrderType() == 4 ? "小件物流订单取消退款" : ""); |
| | | map.put("insertTime", Double.valueOf(transactionDetails1.getInsertTime().getTime() / 1000).intValue()); |
| | | list4.add(map); |
| | | } |
| | | List<Map<String, Object>> list5 = orderTransferService.queryMyTravelRecord(uid);//专车 |
| | | |
| | | list.addAll(maps); |
| | | list.addAll(list1); |
| | | list.addAll(list2); |
| | | list.addAll(list3); |
| | | list.addAll(list4); |
| | | list.addAll(list5); |
| | | |
| | | List<TravelRecordWarpper> orderWarpper = TravelRecordWarpper.getTravelRecordWarpper(list); |
| | | |
| | | //分页 |
| | | if(orderWarpper.size() >= page * size){ |
| | | orderWarpper = orderWarpper.subList(pageNum, pageNum + size); |
| | | }else if(pageNum < orderWarpper.size() && orderWarpper.size() < page * size){ |
| | | orderWarpper = orderWarpper.subList(pageNum, orderWarpper.size()); |
| | | }else{ |
| | | orderWarpper = new ArrayList<>(); |
| | | } |
| | | return ResultUtil.success(orderWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发票页获取订单列表 |
| | | * @param type |
| | | * @param orderType |
| | | * @param startTime |
| | | * @param endTime |
| | | * @param startMoney |
| | | * @param endMoney |
| | | * @param pageNum |
| | | * @param size |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryInvoiceOrder") |
| | | @ApiOperation(value = "发票页获取订单列表", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单开票状态(1=未开票,2=其他)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城出行,4=同城小件物流,5=跨城小件物流 ,7=接送机)", name = "orderType", required = false, dataType = "int"), |
| | | @ApiImplicitParam(value = "开始日期", name = "startTime", required = false, dataType = "string"), |
| | | @ApiImplicitParam(value = "结束日期", name = "endTime", required = false, dataType = "string"), |
| | | @ApiImplicitParam(value = "开始金额", name = "startMoney", required = false, dataType = "double"), |
| | | @ApiImplicitParam(value = "结束金额", name = "endMoney", required = false, dataType = "double"), |
| | | @ApiImplicitParam(value = "页码(首页1)", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<OrderWarpper>> queryInvoiceOrder(Integer type, Integer orderType, Date startTime, |
| | | Date endTime, Double startMoney, Double endMoney, |
| | | Integer pageNum, Integer size, HttpServletRequest request){ |
| | | Integer page = pageNum; |
| | | pageNum = (pageNum - 1) * size; |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | if(null != orderType){ |
| | | switch (orderType){ |
| | | case 1://专车 |
| | | list = orderPrivateCarService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); |
| | | break; |
| | | case 2://出租车 |
| | | list = orderTaxiService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); |
| | | break; |
| | | case 3://跨城 |
| | | list = orderCrossCityService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); |
| | | break; |
| | | case 4://同城小件物流 |
| | | list = orderLogisticsService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid, orderType); |
| | | break; |
| | | case 5://跨城小件物流 |
| | | list = orderLogisticsService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid, orderType); |
| | | break; |
| | | case 7://专车 |
| | | list = orderTransferService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); |
| | | break; |
| | | } |
| | | }else{ |
| | | //专车 |
| | | List<Map<String, Object>> maps = orderPrivateCarService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); |
| | | list.addAll(maps); |
| | | //出租车 |
| | | List<Map<String, Object>> list1 = orderTaxiService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); |
| | | list.addAll(list1); |
| | | //跨城 |
| | | List<Map<String, Object>> list2 = orderCrossCityService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); |
| | | list.addAll(list2); |
| | | //同城小件物流 |
| | | List<Map<String, Object>> list3 = orderLogisticsService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid, orderType); |
| | | list.addAll(list3); |
| | | //跨城小件物流 |
| | | List<Map<String, Object>> list4 = orderLogisticsService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid, orderType); |
| | | list.addAll(list4); |
| | | |
| | | List<Map<String, Object>> list5 = orderTransferService.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); |
| | | list.addAll(list5); |
| | | } |
| | | |
| | | //分页 |
| | | if(list.size() >= page * size){ |
| | | list = list.subList(pageNum, pageNum + size); |
| | | }else if(pageNum < list.size() && list.size() < page * size){ |
| | | list = list.subList(pageNum, list.size()); |
| | | }else{ |
| | | list = new ArrayList<>(); |
| | | } |
| | | |
| | | return ResultUtil.success(OrderWarpper.getOrderWarpper(list)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 继续等待推单操作 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/pushOrderTaxi") |
| | | @ApiOperation(value = "继续等待推单操作", tags = {"用户端-出租车", "用户端-专车","用户端-接送机"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,7=接送机)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil pushOrderTaxi(Integer id, Integer orderType){ |
| | | try { |
| | | switch (orderType){ |
| | | case 1: |
| | | return orderPrivateCarService.pushOrderPrivateCar(id); |
| | | case 2: |
| | | return orderTaxiService.pushOrderTaxi(id); |
| | | case 7 : |
| | | return orderTransferService.pushOrderPrivateCar(id); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取服务中的详情数据 |
| | | * @param orderId |
| | | * @param orderType |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryOrderInfo") |
| | | @ApiOperation(value = "获取服务中的详情数据", tags = {"用户端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,7接送机)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<OrderInfoWarpper> queryOrderInfo(Integer orderId, Integer orderType){ |
| | | try { |
| | | Map<String, Object> map = null; |
| | | switch (orderType){ |
| | | case 1://专车 |
| | | map = orderPrivateCarService.queryOrderInfo(orderId); |
| | | break; |
| | | case 2://出租车 |
| | | map = orderTaxiService.queryOrderInfo(orderId); |
| | | break; |
| | | case 3://跨城 |
| | | map = orderCrossCityService.queryOrderInfo(orderId); |
| | | break; |
| | | case 7://接送机 |
| | | map = orderTransferService.queryOrderInfo(orderId); |
| | | break; |
| | | } |
| | | if(map.get("telX") != null){ |
| | | map.put("driverPhone", map.get("telX")); |
| | | } |
| | | return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取服务中的详情数据 |
| | | * @param orderId |
| | | * @param orderType |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/order/queryOrderInfo_") |
| | | @ApiOperation(value = "获取服务中的详情数据", tags = {"分享专用"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,7=接送机)", name = "orderType", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil<OrderInfoWarpper> queryOrderInfo_(Integer orderId, Integer orderType){ |
| | | try { |
| | | Map<String, Object> map = null; |
| | | switch (orderType){ |
| | | case 1://专车 |
| | | map = orderPrivateCarService.queryOrderInfo(orderId); |
| | | break; |
| | | case 2://出租车 |
| | | map = orderTaxiService.queryOrderInfo(orderId); |
| | | break; |
| | | case 3://跨城 |
| | | map = orderCrossCityService.queryOrderInfo(orderId); |
| | | break; |
| | | case 7://接送机 |
| | | map = orderTransferService.queryOrderInfo(orderId); |
| | | break; |
| | | } |
| | | if(null != map.get("telX")){ |
| | | map.put("driverPhone", map.get("telX")); |
| | | } |
| | | |
| | | return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取订单取消支付页面详情 |
| | | * @param orderId |
| | | * @param orderType |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryCancelPage") |
| | | @ApiOperation(value = "获取订单取消支付页面详情", tags = {"用户端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,7=接送机)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<OrderInfoWarpper> queryCancelPage(Integer orderId, Integer orderType){ |
| | | try { |
| | | Map<String, Object> map = null; |
| | | switch (orderType) { |
| | | case 1://专车 |
| | | map = orderPrivateCarService.queryOrderInfo(orderId); |
| | | ResultUtil<BaseWarpper> res = orderPrivateCarService.queryCancleAmount(orderId); |
| | | map.put("cancelPayMoney", res.getData().getAmount()); |
| | | break; |
| | | case 2://出租车 |
| | | map = orderTaxiService.queryOrderInfo(orderId); |
| | | ResultUtil<BaseWarpper> re = orderTaxiService.queryCancleAmount(orderId); |
| | | map.put("cancelPayMoney", re.getData().getAmount()); |
| | | break; |
| | | case 3://跨城 |
| | | map = orderCrossCityService.queryOrderInfo(orderId); |
| | | ResultUtil<BaseWarpper> r = orderCrossCityService.queryCancleAmount(orderId); |
| | | map.put("cancelPayMoney", r.getData().getAmount()); |
| | | break; |
| | | case 7://接送机 |
| | | map = orderTransferService.queryOrderInfo(orderId); |
| | | ResultUtil<BaseWarpper> r1 = orderTransferService.queryCancleAmount(orderId); |
| | | map.put("cancelPayMoney", r1.getData().getAmount()); |
| | | break; |
| | | } |
| | | return ResultUtil.success(OrderInfoWarpper.getOrderInfoWarpper(map)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取订单轨迹坐标 |
| | | * @param orderId |
| | | * @param orderType |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryTrack") |
| | | @ApiOperation(value = "获取订单轨迹坐标", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil queryTrack(Integer orderId, Integer orderType){ |
| | | try { |
| | | List<Map<String, Object>> list = orderPositionService.queryTrack(orderId, orderType); |
| | | return ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取订单轨迹坐标 |
| | | * @param orderId |
| | | * @param orderType |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/order/queryTrack_") |
| | | @ApiOperation(value = "获取订单轨迹坐标", tags = {"分享专用"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际)", name = "orderType", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil queryTrack_(Integer orderId, Integer orderType){ |
| | | try { |
| | | List<Map<String, Object>> list = orderPositionService.queryTrack(orderId, orderType); |
| | | return ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送订单状态 |
| | | * @param id |
| | | * @param orderType |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/order/sendOrderState") |
| | | public ResultUtil cancelOrder(Integer id, Integer orderType){ |
| | | try { |
| | | Integer driverId = null; |
| | | Integer userId = null; |
| | | Integer state = 0; |
| | | switch (orderType){ |
| | | case 1: |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(id); |
| | | driverId = orderPrivateCar.getDriverId(); |
| | | userId = orderPrivateCar.getUserId(); |
| | | state = orderPrivateCar.getState(); |
| | | if(null != driverId){ |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); |
| | | } |
| | | break; |
| | | case 2: |
| | | OrderTaxi orderTaxi = orderTaxiService.selectById(id); |
| | | driverId = orderTaxi.getDriverId(); |
| | | userId = orderTaxi.getUserId(); |
| | | state = orderTaxi.getState(); |
| | | if(null != driverId){ |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); |
| | | } |
| | | break; |
| | | case 3: |
| | | OrderCrossCity orderCrossCity = orderCrossCityService.selectById(id); |
| | | driverId = orderCrossCity.getDriverId(); |
| | | userId = orderCrossCity.getUserId(); |
| | | state = orderCrossCity.getState(); |
| | | if(orderCrossCity.getPayMoney() == null && state == 10){//支付的情况才推送取消 |
| | | break; |
| | | }else{ |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); |
| | | } |
| | | break; |
| | | case 4: |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(id); |
| | | driverId = orderLogistics.getDriverId(); |
| | | userId = orderLogistics.getUserId(); |
| | | state = orderLogistics.getState(); |
| | | if(orderLogistics.getPayMoney() == null && state == 10){//支付的情况才推送取消 |
| | | break; |
| | | }else{ |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); |
| | | } |
| | | break; |
| | | case 5: |
| | | OrderLogistics orderLogistics1 = orderLogisticsService.selectById(id); |
| | | driverId = orderLogistics1.getDriverId(); |
| | | userId = orderLogistics1.getUserId(); |
| | | state = orderLogistics1.getState(); |
| | | if(orderLogistics1.getPayMoney() == null && state == 10){//支付的情况才推送取消 |
| | | break; |
| | | }else{ |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); |
| | | } |
| | | break; |
| | | |
| | | case 7: |
| | | OrderTransferCar orderTransferCar = orderTransferService.selectById(id); |
| | | driverId = orderTransferCar.getDriverId(); |
| | | userId = orderTransferCar.getUserId(); |
| | | state = orderTransferCar.getState(); |
| | | if(null != driverId){ |
| | | pushUtil.pushOrderState(2, driverId, id, orderType, state, 0); |
| | | } |
| | | break; |
| | | } |
| | | pushUtil.pushOrderState(1, userId, id, orderType, state, 0); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * APP调用微信小程序支付 |
| | | * @param orderId |
| | | * @param orderType |
| | | * @param type |
| | | * @param content |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/order/weChatPay") |
| | | @ApiOperation(value = "APP调用微信小程序支付", tags = {"用户端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "业务类型(1=订单完成支付,2=订单取消支付,3=司机端改派支付,4=余额充值,5=小件物流差价支付)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "端口类型(1=用户端,2=司机端)", name = "userType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "用户id", name = "uid", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "附加参数{\"key\":\"value\"}", name = "content", required = true, dataType = "string") |
| | | }) |
| | | public ResultUtil weChatPay(Integer orderId, Integer orderType, Integer type, Integer userType, Integer uid, String content){ |
| | | try { |
| | | return orderService.weChatPay(orderId, orderType, type, userType, uid, content); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/order/queryUserOpenId") |
| | | @ApiOperation(value = "获取用户的微信openid", tags = {"用户端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "端口类型(1=用户端,2=司机端)", name = "userType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "用户id", name = "uid", required = true, dataType = "int") |
| | | }) |
| | | public ResultUtil queryUserOpenId(Integer uid, Integer userType){ |
| | | if(userType == 2){ |
| | | Driver driver = driverService.selectById(uid); |
| | | return ResultUtil.success(driver.getAppletsOpenId()); |
| | | } |
| | | if(userType == 1){ |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | return ResultUtil.success(userInfo.getAppletsOpenId()); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/order/getWeChatOpenId") |
| | | @ApiOperation(value = "用户授权获取小程序openid", tags = {"用户端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "端口类型(1=用户端,2=司机端)", name = "userType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "用户id", name = "uid", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "小程序授权临时凭证", name = "jscode", required = true, dataType = "string"), |
| | | }) |
| | | public ResultUtil getWeChatOpenId(Integer uid, Integer userType, String jscode){ |
| | | Map<String, String> map = weChatUtil.code2Session(jscode); |
| | | if(userType == 2){ |
| | | Driver driver = driverService.selectById(uid); |
| | | driver.setAppletsOpenId(map.get("openid")); |
| | | driverService.updateById(driver); |
| | | } |
| | | if(userType == 1){ |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | userInfo.setAppletsOpenId(map.get("openid")); |
| | | userInfoService.updateById(userInfo); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取预计行驶时间 |
| | | * @param slon |
| | | * @param slat |
| | | * @param elon |
| | | * @param elat |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/taxi/queryExpectedTime") |
| | | @ApiOperation(value = "选择地点和终点后获取预计行驶时长", tags = {"用户端-出租车", "用户端-专车"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "起点经度", name = "slon", required = true, dataType = "double"), |
| | | @ApiImplicitParam(value = "起点纬度", name = "slat", required = true, dataType = "double"), |
| | | @ApiImplicitParam(value = "终点经度", name = "elon", required = true, dataType = "double"), |
| | | @ApiImplicitParam(value = "终点纬度", name = "elat", required = true, dataType = "double") |
| | | }) |
| | | public ResultUtil<BaseWarpper> queryExpectedTime(Double slon, Double slat, Double elon, Double elat){ |
| | | try { |
| | | return orderService.queryExpectedTime(slon, slat, elon, elat); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取取消订单需要支付的费用金额 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/queryCancleAmount") |
| | | @ApiOperation(value = "获取取消订单需要支付的费用金额", tags = {"用户端-出租车", "用户端-专车","用户端-接送机"}, notes = "返回金额为0则不需要支付") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,7=接送机)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<BaseWarpper> queryCancleAmount(Integer id, Integer orderType){ |
| | | try { |
| | | switch (orderType){ |
| | | case 1: |
| | | return orderPrivateCarService.queryCancleAmount(id); |
| | | case 2: |
| | | return orderTaxiService.queryCancleAmount(id); |
| | | case 3: |
| | | return orderCrossCityService.queryCancleAmount(id); |
| | | case 7: |
| | | return orderTransferService.queryCancleAmount(id); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加取消记录 |
| | | * @param id |
| | | * @param reason |
| | | * @param remark |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/addCancle") |
| | | @ApiOperation(value = "添加取消记录", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-接送机"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,7=接送机)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "取消原因", name = "reason", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "备注", name = "remark", required = false, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil addCancle(Integer id, Integer orderType, String reason, String remark, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | switch (orderType){ |
| | | case 1: |
| | | return orderPrivateCarService.addCancle(id, reason, remark, uid); |
| | | case 2: |
| | | return orderTaxiService.addCancle(id, reason, remark, uid); |
| | | case 3: |
| | | return orderCrossCityService.addCancle(id, reason, remark, uid); |
| | | case 4: |
| | | return orderLogisticsService.addCancle(id, reason, remark, uid); |
| | | case 5: |
| | | return orderLogisticsService.addCancle(id, reason, remark, uid); |
| | | case 6: |
| | | return orderCharteredCarService.addCancle(id, reason, remark, uid); |
| | | case 7: |
| | | return orderTransferService.addCancle(id, reason, remark, uid); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 取消操作支付 |
| | | * @param id |
| | | * @param payType |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/cancleOrderTaxi") |
| | | @ApiOperation(value = "取消操作支付", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-接送机"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,7接送机)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "支付方式(1=微信,2=支付宝,3=余额)", name = "payType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "取消单id(取消操作返回)", name = "cancleId", required = false, dataType = "int"), |
| | | @ApiImplicitParam(value = "支付端(1=用户APP端,2=司机APP端,3=用户小程序端)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil cancleOrderTaxi(Integer id, Integer orderType, Integer payType, Integer cancleId, Integer type, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | switch (orderType){ |
| | | case 1: |
| | | return orderPrivateCarService.cancleOrderPrivateCar(id, payType, cancleId, type); |
| | | case 2: |
| | | return orderTaxiService.cancleOrderTaxi(id, payType, cancleId, type); |
| | | case 3: |
| | | return orderCrossCityService.cancleOrderCrossCity(id, payType, cancleId, type); |
| | | case 7: |
| | | return orderTransferService.cancleOrderPrivateCar(id, payType, cancleId, type); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 投诉操作 |
| | | * @param driverId |
| | | * @param reason |
| | | * @param description |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/complaintService") |
| | | @ApiOperation(value = "添加投诉操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "司机id", name = "driverId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "投诉原因", name = "reason", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "投诉描述", name = "description", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil complaintService(Integer driverId, String reason, String description, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | complaintService.saveData(driverId, reason, description, uid); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 支付页面获取可用优惠券数量和余额 |
| | | * @param orderId |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/queryBalance") |
| | | @ApiOperation(value = "支付页面获取可用优惠券数量和余额", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-接送机"}, notes = "balance=余额,coupon=优惠券") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,7=接送机)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil queryBalance(Integer orderId, Integer orderType, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | switch (orderType){ |
| | | case 1: |
| | | map = orderPrivateCarService.queryBalance(orderId, uid); |
| | | break; |
| | | case 2: |
| | | map = orderTaxiService.queryBalance(orderId, uid); |
| | | break; |
| | | case 3: |
| | | map = orderCrossCityService.queryBalance(orderId, uid); |
| | | break; |
| | | case 4: |
| | | map = orderLogisticsService.queryBalance(orderId, uid); |
| | | break; |
| | | case 5: |
| | | map = orderLogisticsService.queryBalance(orderId, uid); |
| | | break; |
| | | case 7: |
| | | map = orderTransferService.queryBalance(orderId, uid); |
| | | break; |
| | | } |
| | | return ResultUtil.success(map); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | @Autowired |
| | | private IUserCouponRecordService userCouponRecordService; |
| | | |
| | | |
| | | /** |
| | | * 获取支付页面的优惠券列表 |
| | | * @param orderId |
| | | * @param pageNum |
| | | * @param size |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/queryCoupon") |
| | | @ApiOperation(value = "获取支付页面的优惠券列表", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-接送机"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,7接送机)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil queryCoupon(Integer orderId, Integer orderType, Integer pageNum, Integer size, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | switch (orderType){ |
| | | case 1: |
| | | list = orderPrivateCarService.queryCoupon(orderId, uid, pageNum, size); |
| | | break; |
| | | case 2: |
| | | list = orderTaxiService.queryCoupon(orderId, uid, pageNum, size); |
| | | break; |
| | | case 3: |
| | | list = orderCrossCityService.queryCoupon(orderId, uid, pageNum, size); |
| | | break; |
| | | case 7: |
| | | list = orderTransferService.queryCoupon(orderId, uid, pageNum, size); |
| | | break; |
| | | } |
| | | //将activityType=5的数据进行处理 |
| | | |
| | | // List<Integer> ids = new ArrayList<>(); |
| | | |
| | | // if (list != null && list.size() > 0) { |
| | | // Map<Object, Integer> couponIdMonthlyCount = new HashMap<>(); // 用来统计每个月各couponId的出现次数 |
| | | // Date currentDate = new Date(); // 获取当前日期 |
| | | // Calendar cal = Calendar.getInstance(); |
| | | // cal.setTime(currentDate); |
| | | // int currentMonth = cal.get(Calendar.MONTH) + 1; // 获取当前月份(注意Calendar.MONTH是从0开始的) |
| | | // |
| | | // // 首先,统计每个月各couponId的出现次数 |
| | | // for (Map<String, Object> map : list) { |
| | | // if (map.get("activityType").equals(5)) { |
| | | // for (UserCouponRecord userCouponRecord : userCouponRecordService.selectList(new EntityWrapper<UserCouponRecord>().eq("couponId", map.get("couponId")))) { |
| | | // Date endTime = userCouponRecord.getEndTime(); |
| | | // Calendar recordCal = Calendar.getInstance(); |
| | | // if (endTime==null){ |
| | | // continue; |
| | | // } |
| | | // recordCal.setTime(endTime); |
| | | // int recordMonth = recordCal.get(Calendar.MONTH) + 1; |
| | | // |
| | | // if (recordMonth == currentMonth) { |
| | | // Object couponId = map.get("couponId"); |
| | | // couponIdMonthlyCount.put(couponId, couponIdMonthlyCount.getOrDefault(couponId, 0) + 1); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // // 然后,根据统计结果移除当月数量超过1的couponId对应的记录 |
| | | // List<Map<String, Object>> newList = new ArrayList<>(); |
| | | // for (Map<String, Object> map : list) { |
| | | // Object couponId = map.get("couponId"); |
| | | // if (!couponIdMonthlyCount.containsKey(couponId) || couponIdMonthlyCount.get(couponId) <= 1) { |
| | | // newList.add(map); |
| | | // } |
| | | // } |
| | | // list.clear(); |
| | | // list.addAll(newList); |
| | | // } |
| | | |
| | | |
| | | return ResultUtil.success(CouponWarpper.getCouponWarppers(list)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | @Autowired |
| | | private ITActivityGeneralizationService activityGeneralizationService; |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/check") |
| | | @ApiOperation(value = "判断是否到到当月限额", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-接送机"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil check(Integer id,HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | // 查询当前活动的限制数量 |
| | | UserCouponRecord userCouponRecords1 = userCouponRecordService.selectById(id); |
| | | |
| | | List<UserCouponRecord> userCouponRecords = userCouponRecordService.selectList(new EntityWrapper<UserCouponRecord>().eq("couponId", userCouponRecords1.getCouponId())); |
| | | |
| | | // 获取活动限制数量 |
| | | TActivityGeneralization tActivityGeneralization = activityGeneralizationService.selectById(userCouponRecords.get(0).getCouponActivityId()); |
| | | if (tActivityGeneralization == null) { |
| | | throw new RuntimeException("未能找到对应的活动信息"); |
| | | } |
| | | int limitQuantity = tActivityGeneralization.getMonthUseCount(); // 假设limitQuantity字段代表限制数量 |
| | | |
| | | // 判断当月的优惠券是否超过限制 |
| | | Calendar currentCal = Calendar.getInstance(); |
| | | int currentMonth = currentCal.get(Calendar.MONTH) + 1; // 当前月份 |
| | | |
| | | // 统计当月的优惠券使用数量 |
| | | int usedThisMonth = 0; |
| | | for (UserCouponRecord record : userCouponRecords) { |
| | | if (record.getEndTime()==null){ |
| | | continue; |
| | | } |
| | | Calendar recordCal = Calendar.getInstance(); |
| | | recordCal.setTime(record.getEndTime()); |
| | | int recordMonth = recordCal.get(Calendar.MONTH) + 1; |
| | | |
| | | // 判断endTime是否在当月 |
| | | if (recordMonth == currentMonth) { |
| | | usedThisMonth++; |
| | | } |
| | | } |
| | | |
| | | // 判断是否超过限制 |
| | | if (usedThisMonth >= limitQuantity) { |
| | | return ResultUtil.error("本月使用数量已经超出限制"); |
| | | // 这里可以添加更多的逻辑处理,比如抛出异常、记录日志等 |
| | | } else { |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 订单完成支付订单操作 |
| | | * @param payType |
| | | * @param orderId |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/payTaxiOrder") |
| | | @ApiOperation(value = "订单完成支付订单操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城", "用户端-小件物流","用户端-接送机"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "支付方式(1=微信,2=支付宝,3=余额)", name = "payType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,4=小件物流,7=接送机)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "优惠券id", name = "couponId", required = false, dataType = "int"), |
| | | @ApiImplicitParam(value = "支付端(1=用户APP端,2=司机APP端,3=用户小程序端)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil payTaxiOrder(Integer payType, Integer orderId, Integer orderType, Integer couponId, Integer type, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | switch (orderType){ |
| | | case 1: |
| | | return orderPrivateCarService.payPrivateCarOrder(payType, orderId, couponId, type); |
| | | case 2: |
| | | return orderTaxiService.payTaxiOrder(payType, orderId, couponId, type); |
| | | case 3: |
| | | return orderCrossCityService.payCrossCityOrder(payType, orderId, couponId, type); |
| | | case 4: |
| | | return orderLogisticsService.payLogisticsOrder(payType, orderId, type); |
| | | case 5: |
| | | return orderLogisticsService.payLogisticsOrder(payType, orderId, type); |
| | | case 7: |
| | | return orderTransferService.payPrivateCarOrder(payType, orderId, couponId, type); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 订单完成后添加评价操作 |
| | | * @param orderId |
| | | * @param fraction |
| | | * @param content |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/orderEvaluate") |
| | | @ApiOperation(value = "订单完成后添加评价操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "评分", name = "fraction", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "评价内容", name = "content", required = false, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil orderEvaluate(Integer orderId, Integer orderType, Integer fraction, String content){ |
| | | try { |
| | | ResultUtil resultUtil = orderEvaluateService.saveData(orderId, orderType, fraction, content); |
| | | if(resultUtil.getCode() == 200){ |
| | | switch (orderType){ |
| | | case 1: |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | orderPrivateCar.setState(9); |
| | | orderPrivateCarService.updateById(orderPrivateCar); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.ratedPassenger(Integer.valueOf(resultUtil.getData().toString())); |
| | | pushMinistryOfTransportUtil.ratedDriver(orderPrivateCar.getDriverId()); |
| | | } |
| | | } |
| | | }).start(); |
| | | break; |
| | | case 2: |
| | | OrderTaxi orderTaxi = orderTaxiService.selectById(orderId); |
| | | orderTaxi.setState(9); |
| | | orderTaxiService.updateById(orderTaxi); |
| | | break; |
| | | case 3: |
| | | OrderCrossCity orderCrossCity = orderCrossCityService.selectById(orderId); |
| | | orderCrossCity.setState(9); |
| | | orderCrossCityService.updateById(orderCrossCity); |
| | | break; |
| | | case 7: |
| | | OrderTransferCar orderTransferCar = orderTransferService.selectById(orderId); |
| | | orderTransferCar.setState(9); |
| | | orderTransferService.updateById(orderTransferCar); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.ratedPassenger(Integer.valueOf(resultUtil.getData().toString())); |
| | | pushMinistryOfTransportUtil.ratedDriver(orderTransferCar.getDriverId()); |
| | | } |
| | | } |
| | | }).start(); |
| | | break; |
| | | } |
| | | } |
| | | return resultUtil.getCode() == 200 ? ResultUtil.success() : resultUtil; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 评论成功后获取红包金额 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/queryRedMoney") |
| | | @ApiOperation(value = "评论成功后获取红包金额", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-接送机"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型(1=专车,2=出租车,3=跨城,7=接送机)", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<BaseWarpper> queryRedMoney(Integer orderId, Integer orderType){ |
| | | try { |
| | | switch (orderType){ |
| | | case 1: |
| | | return orderPrivateCarService.queryRedMoney(orderId); |
| | | case 2: |
| | | return orderTaxiService.queryRedMoney(orderId); |
| | | case 3: |
| | | return orderCrossCityService.queryRedMoney(orderId); |
| | | case 7: |
| | | return orderTransferService.queryRedMoney(orderId); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 分享成功后添加红包操作 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/taxi/shareRedEnvelope") |
| | | @ApiOperation(value = "分享成功后添加红包操作", tags = {"用户端-出租车", "用户端-专车", "用户端-跨城","用户端-接送机"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单类型", name = "orderType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil shareRedEnvelope(Integer orderId, Integer orderType){ |
| | | try { |
| | | switch (orderType){ |
| | | case 1: |
| | | return orderPrivateCarService.shareRedEnvelope(orderId); |
| | | case 2: |
| | | return orderTaxiService.shareRedEnvelope(orderId); |
| | | case 3: |
| | | return orderCrossCityService.shareRedEnvelope(orderId); |
| | | case 7: |
| | | return orderTransferService.shareRedEnvelope(orderId); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 取消订单微信回调 |
| | | * @param request |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/wxCancelOrderTaxi") |
| | | public void wxCancelOrderTaxi(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | if(null != map){ |
| | | String order_id = map.get("transaction_id"); |
| | | String out_trade_no = map.get("out_trade_no"); |
| | | String result = map.get("result"); |
| | | if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id)){ |
| | | PrintWriter out = response.getWriter(); |
| | | out.write(result); |
| | | out.flush(); |
| | | out.close(); |
| | | |
| | | String[] split = out_trade_no.split("_"); |
| | | Integer id = Integer.valueOf(split[0]); |
| | | Integer type = Integer.valueOf(split[1]); |
| | | switch (type){ |
| | | case 1: |
| | | orderPrivateCarService.payCancelOrderPrivateCar(id, order_id, 1); |
| | | break; |
| | | case 2: |
| | | orderTaxiService.payCancelOrderTaxi(id, order_id, 1); |
| | | break; |
| | | case 3: |
| | | orderCrossCityService.payCancelOrderCrossCity(id, order_id, 1); |
| | | break; |
| | | case 7: |
| | | orderTransferService.payCancelOrderPrivateCar(id, order_id, 1); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | // Map<String, String> map = icbcPayUtil.payCallback(request); |
| | | // if(null != map){ |
| | | // String out_trade_no = map.get("out_trade_no"); |
| | | // String order_id = map.get("order_id"); |
| | | // String s = icbcPayUtil.queryTransaction("", order_id); |
| | | // if(s.equals("0")){ |
| | | // icbcPayUtil.answer(response);//回调应答 |
| | | // } |
| | | // if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id) && s.equals("0")){ |
| | | // String[] split = out_trade_no.split(","); |
| | | // Integer id = Integer.valueOf(split[0]); |
| | | // Integer type = Integer.valueOf(split[1]); |
| | | // switch (type){ |
| | | // case 1: |
| | | // orderPrivateCarService.payCancelOrderPrivateCar(id, order_id, 1); |
| | | // break; |
| | | // case 2: |
| | | // orderTaxiService.payCancelOrderTaxi(id, order_id, 1); |
| | | // break; |
| | | // case 3: |
| | | // orderCrossCityService.payCancelOrderCrossCity(id, order_id, 1); |
| | | // break; |
| | | // } |
| | | // } |
| | | // |
| | | // } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 取消订单支付宝回调 |
| | | * @param request |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/aliCancelOrderTaxi") |
| | | public void aliCancelOrderTaxi(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request); |
| | | if(null != map){ |
| | | String out_trade_no = map.get("out_trade_no"); |
| | | String order_id = map.get("trade_no"); |
| | | if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id)){ |
| | | String[] split = out_trade_no.split("_"); |
| | | Integer id = Integer.valueOf(split[0]); |
| | | Integer type = Integer.valueOf(split[1]); |
| | | switch (type){ |
| | | case 1: |
| | | orderPrivateCarService.payCancelOrderPrivateCar(id, order_id, 2); |
| | | break; |
| | | case 2: |
| | | orderTaxiService.payCancelOrderTaxi(id, order_id, 2); |
| | | break; |
| | | case 3: |
| | | orderCrossCityService.payCancelOrderCrossCity(id, order_id, 2); |
| | | break; |
| | | case 7: |
| | | orderTransferService.payCancelOrderPrivateCar(id, order_id, 2); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | // Map<String, String> map = icbcPayUtil.payCallback(request); |
| | | // if(null != map){ |
| | | // String out_trade_no = map.get("out_trade_no"); |
| | | // String order_id = map.get("order_id"); |
| | | // String s = icbcPayUtil.queryTransaction("", order_id); |
| | | // if(s.equals("0")){ |
| | | // icbcPayUtil.answer(response);//回调应答 |
| | | // } |
| | | // if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id) && s.equals("0")){ |
| | | // String[] split = out_trade_no.split(","); |
| | | // Integer id = Integer.valueOf(split[0]); |
| | | // Integer type = Integer.valueOf(split[1]); |
| | | // switch (type){ |
| | | // case 1: |
| | | // orderPrivateCarService.payCancelOrderPrivateCar(id, order_id, 2); |
| | | // break; |
| | | // case 2: |
| | | // orderTaxiService.payCancelOrderTaxi(id, order_id, 2); |
| | | // break; |
| | | // case 3: |
| | | // orderCrossCityService.payCancelOrderCrossCity(id, order_id, 2); |
| | | // break; |
| | | // } |
| | | // } |
| | | // |
| | | // } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 完成订单微信支付回调 |
| | | * @param request |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/wxPayOrderTaxi") |
| | | public void wxPayOrderTaxi(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | if(null != map){ |
| | | String order_id = map.get("transaction_id"); |
| | | String out_trade_no = map.get("out_trade_no"); |
| | | String result = map.get("result"); |
| | | if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id)){ |
| | | PrintWriter out = response.getWriter(); |
| | | out.write(result); |
| | | out.flush(); |
| | | out.close(); |
| | | |
| | | String[] split = out_trade_no.split("_"); |
| | | Integer id = Integer.valueOf(split[0]); |
| | | Integer type = Integer.valueOf(split[1]); |
| | | switch (type){ |
| | | case 1: |
| | | orderPrivateCarService.payOrderPrivateCarCallback(id, order_id, 1); |
| | | break; |
| | | case 2: |
| | | orderTaxiService.payOrderTaxiCallback(id, order_id, 1); |
| | | break; |
| | | case 3: |
| | | orderCrossCityService.payOrderCrossCityCallback(id, order_id, 1); |
| | | break; |
| | | case 4: |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, 1); |
| | | break; |
| | | case 5: |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, 1); |
| | | break; |
| | | case 7: |
| | | orderTransferService.payOrderPrivateCarCallback(id, order_id, 1); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // Map<String, String> map = icbcPayUtil.payCallback(request); |
| | | // if(null != map){ |
| | | // String out_trade_no = map.get("out_trade_no"); |
| | | // String order_id = map.get("order_id"); |
| | | // String s = icbcPayUtil.queryTransaction("", order_id); |
| | | // if(s.equals("0")){ |
| | | // icbcPayUtil.answer(response);//回调应答 |
| | | // } |
| | | // if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id) && s.equals("0")){ |
| | | // String[] split = out_trade_no.split(","); |
| | | // Integer id = Integer.valueOf(split[0]); |
| | | // Integer type = Integer.valueOf(split[1]); |
| | | // switch (type){ |
| | | // case 1: |
| | | // orderPrivateCarService.payOrderPrivateCarCallback(id, order_id, 1); |
| | | // break; |
| | | // case 2: |
| | | // orderTaxiService.payOrderTaxiCallback(id, order_id, 1); |
| | | // break; |
| | | // case 3: |
| | | // orderCrossCityService.payOrderCrossCityCallback(id, order_id, 1); |
| | | // break; |
| | | // case 4: |
| | | // orderLogisticsService.payOrderLogisticsCallback(id, order_id, 1); |
| | | // break; |
| | | // case 5: |
| | | // orderLogisticsService.payOrderLogisticsCallback(id, order_id, 1); |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 完成订单支付宝支付回调 |
| | | * @param request |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/aliPayOrderTaxi") |
| | | public void aliPayOrderTaxi(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request); |
| | | if(null != map){ |
| | | String out_trade_no = map.get("out_trade_no"); |
| | | String order_id = map.get("trade_no"); |
| | | if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id)){ |
| | | String[] split = out_trade_no.split("_"); |
| | | Integer id = Integer.valueOf(split[0]); |
| | | Integer type = Integer.valueOf(split[1]); |
| | | switch (type){ |
| | | case 1: |
| | | orderPrivateCarService.payOrderPrivateCarCallback(id, order_id, 2); |
| | | break; |
| | | case 2: |
| | | orderTaxiService.payOrderTaxiCallback(id, order_id, 2); |
| | | break; |
| | | case 3: |
| | | orderCrossCityService.payOrderCrossCityCallback(id, order_id, 2); |
| | | break; |
| | | case 4: |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2); |
| | | break; |
| | | case 5: |
| | | orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2); |
| | | break; |
| | | case 7: |
| | | orderTransferService.payOrderPrivateCarCallback(id, order_id, 2); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | // Map<String, String> map = icbcPayUtil.payCallback(request); |
| | | // if(null != map){ |
| | | // String out_trade_no = map.get("out_trade_no"); |
| | | // String order_id = map.get("order_id"); |
| | | // String s = icbcPayUtil.queryTransaction("", order_id); |
| | | // if(s.equals("0")){ |
| | | // icbcPayUtil.answer(response);//回调应答 |
| | | // } |
| | | // if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id) && s.equals("0")){ |
| | | // String[] split = out_trade_no.split(","); |
| | | // Integer id = Integer.valueOf(split[0]); |
| | | // Integer type = Integer.valueOf(split[1]); |
| | | // switch (type){ |
| | | // case 1: |
| | | // orderPrivateCarService.payOrderPrivateCarCallback(id, order_id, 2); |
| | | // break; |
| | | // case 2: |
| | | // orderTaxiService.payOrderTaxiCallback(id, order_id, 2); |
| | | // break; |
| | | // case 3: |
| | | // orderCrossCityService.payOrderCrossCityCallback(id, order_id, 2); |
| | | // break; |
| | | // case 4: |
| | | // orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2); |
| | | // break; |
| | | // case 5: |
| | | // orderLogisticsService.payOrderLogisticsCallback(id, order_id, 2); |
| | | // break; |
| | | // } |
| | | // } |
| | | // |
| | | // } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 小件物流差价微信支付回调 |
| | | * @param request |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/wxPayOrderLogisticsSpread") |
| | | public void wxPayOrderLogisticsSpread(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | if(null != map){ |
| | | String order_id = map.get("transaction_id"); |
| | | String out_trade_no = map.get("out_trade_no"); |
| | | String result = map.get("result"); |
| | | if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id)){ |
| | | PrintWriter out = response.getWriter(); |
| | | out.write(result); |
| | | out.flush(); |
| | | out.close(); |
| | | |
| | | String[] split = out_trade_no.split("_"); |
| | | Integer id = Integer.valueOf(split[0]); |
| | | Integer type = Integer.valueOf(split[1]); |
| | | orderLogisticsService.payOrderLogisticsSpreadCallback(id, order_id, 1); |
| | | } |
| | | } |
| | | |
| | | // Map<String, String> map = icbcPayUtil.payCallback(request); |
| | | // if(null != map){ |
| | | // String out_trade_no = map.get("out_trade_no"); |
| | | // String order_id = map.get("order_id"); |
| | | // String s = icbcPayUtil.queryTransaction("", order_id); |
| | | // if(s.equals("0")){ |
| | | // icbcPayUtil.answer(response);//回调应答 |
| | | // } |
| | | // if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id) && s.equals("0")){ |
| | | // String[] split = out_trade_no.split(","); |
| | | // Integer id = Integer.valueOf(split[0]); |
| | | // Integer type = Integer.valueOf(split[1]); |
| | | // orderLogisticsService.payOrderLogisticsSpreadCallback(id, order_id, 1); |
| | | // } |
| | | // } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 小件物流差价支付宝支付回调 |
| | | * @param request |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/aliPayOrderLogisticsSpread") |
| | | public void aliPayOrderLogisticsSpread(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request); |
| | | if(null != map){ |
| | | String out_trade_no = map.get("out_trade_no"); |
| | | String order_id = map.get("trade_no"); |
| | | if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id)){ |
| | | String[] split = out_trade_no.split("_"); |
| | | Integer id = Integer.valueOf(split[0]); |
| | | Integer type = Integer.valueOf(split[1]); |
| | | orderLogisticsService.payOrderLogisticsSpreadCallback(id, order_id, 2); |
| | | } |
| | | |
| | | } |
| | | |
| | | // Map<String, String> map = icbcPayUtil.payCallback(request); |
| | | // if(null != map){ |
| | | // String out_trade_no = map.get("out_trade_no"); |
| | | // String order_id = map.get("order_id"); |
| | | // String s = icbcPayUtil.queryTransaction("", order_id); |
| | | // if(s.equals("0")){ |
| | | // icbcPayUtil.answer(response);//回调应答 |
| | | // } |
| | | // if(ToolUtil.isNotEmpty(out_trade_no) && ToolUtil.isNotEmpty(order_id) && s.equals("0")){ |
| | | // String[] split = out_trade_no.split(","); |
| | | // Integer id = Integer.valueOf(split[0]); |
| | | // Integer type = Integer.valueOf(split[1]); |
| | | // orderLogisticsService.payOrderLogisticsSpreadCallback(id, order_id, 2); |
| | | // } |
| | | // |
| | | // } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.stylefeng.guns.modular.system.model.Phone; |
| | | import com.stylefeng.guns.modular.system.service.IPhoneService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 系统电话控制器 |
| | | */ |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("/base/phone") |
| | | public class PhoneController { |
| | | |
| | | @Autowired |
| | | private IPhoneService phoneService; |
| | | |
| | | /** |
| | | * 获取系统所有电话 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryPhones") |
| | | @ApiOperation(value = "获取首页电话", tags = {"用户端-首页", "用户端-包车"}, notes = "type=1(报警电话),type=2(投诉电话),type=3(包车调度电话)") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "当前定位行政区域编号", name = "code", required = true, dataType = "string") |
| | | }) |
| | | public ResultUtil queryPhones(String code){ |
| | | try { |
| | | List<Phone> phones = phoneService.queryPhones(code); |
| | | return ResultUtil.success(phones); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取个人中心的客服电话 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryCustomerPhone") |
| | | @ApiOperation(value = "获取个人中心的客服电话", tags = {"用户端-个人中心"}, notes = "platform(平台电话),company(本地电话)") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "当前定位行政区域编号", name = "code", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil queryCustomerPhone(String code){ |
| | | try { |
| | | Map<String, Object> map = phoneService.queryCustomerPhone(code); |
| | | return ResultUtil.success(map); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.stylefeng.guns.modular.system.service.IProblemService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.ProblemWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 在线客服控制器 |
| | | */ |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("/api/problem") |
| | | public class ProblemController { |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | @Autowired |
| | | private IProblemService problemService; |
| | | |
| | | |
| | | /** |
| | | * 添加客服留言 |
| | | * @param content |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/leaveMessage") |
| | | @ApiOperation(value = "添加客服留言", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "留言内容", name = "content", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil leaveMessage(String content, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return problemService.leaveMessage(content, uid); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取历史提交的留言列表 |
| | | * @param pageNum |
| | | * @param size |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryProblems") |
| | | @ApiOperation(value = "获取历史提交的留言列表", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<ProblemWarpper>> queryProblems(Integer pageNum, Integer size, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<Map<String, Object>> maps = problemService.queryProblems(pageNum, size, uid); |
| | | return ResultUtil.success(ProblemWarpper.getProblemWarpper(maps)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.service.IUserRedPacketRecordService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.TravelRecordWarpper; |
| | | import com.stylefeng.guns.modular.taxi.model.PaymentRecord; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import com.stylefeng.guns.modular.transfer.server.IOrderTransferService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 红包控制器 |
| | | */ |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("/api/redEnvelope") |
| | | public class RedEnvelopeController { |
| | | |
| | | @Autowired |
| | | private IUserRedPacketRecordService userRedPacketRecordService; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | @Autowired |
| | | private IOrderTaxiService orderTaxiService; |
| | | |
| | | @Autowired |
| | | private IOrderPrivateCarService orderPrivateCarService; |
| | | |
| | | @Autowired |
| | | private IOrderCrossCityService orderCrossCityService; |
| | | |
| | | @Autowired |
| | | private IOrderTransferService orderTransferService; |
| | | |
| | | |
| | | /** |
| | | * 获取红包列表 |
| | | * @param pageNum |
| | | * @param size |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryMyRedEnvelope") |
| | | @ApiOperation(value = "获取红包列表", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码(首页1)", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<BaseWarpper>> queryMyRedEnvelope(Integer pageNum, Integer size, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<Map<String, Object>> list = userRedPacketRecordService.queryMyRedEnvelope(pageNum, size, uid); |
| | | List<BaseWarpper> baseWarppers = new ArrayList<>(); |
| | | for(Map<String, Object> map : list){ |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setId(null != map.get("id") ? Integer.valueOf(String.valueOf(map.get("id"))) : 0); |
| | | baseWarpper.setAmount(null != map.get("money") ? Double.valueOf(String.valueOf(map.get("money"))) : 0); |
| | | baseWarpper.setName(null != map.get("name") ? String.valueOf(map.get("name")) : ""); |
| | | baseWarppers.add(baseWarpper); |
| | | } |
| | | return ResultUtil.success(baseWarppers); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取红包使用记录 |
| | | * @param pageNum |
| | | * @param size |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryRedEnvelope") |
| | | @ApiOperation(value = "获取红包使用记录", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码(首页1)", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<TravelRecordWarpper>> queryRedEnvelope(Integer pageNum, Integer size, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Integer page = pageNum; |
| | | pageNum = (pageNum - 1) * size; |
| | | List<Map<String, Object>> list = orderPrivateCarService.queryRedEnvelope(uid);//专车 |
| | | List<Map<String, Object>> list1 = orderTaxiService.queryRedEnvelope(uid);//出租车 |
| | | List<Map<String, Object>> list2 = orderCrossCityService.queryRedEnvelope(uid);//跨城 |
| | | List<Map<String, Object>> list3 = orderTransferService.queryRedEnvelope(uid);//专车 |
| | | |
| | | list.addAll(list1); |
| | | list.addAll(list2); |
| | | list.addAll(list3); |
| | | |
| | | List<TravelRecordWarpper> orderWarpper = TravelRecordWarpper.getTravelRecordWarpper(list); |
| | | |
| | | //分页 |
| | | if(orderWarpper.size() >= page * size){ |
| | | orderWarpper = orderWarpper.subList(pageNum, pageNum + size); |
| | | }else if(pageNum < orderWarpper.size() && orderWarpper.size() < page * size){ |
| | | orderWarpper = orderWarpper.subList(pageNum, orderWarpper.size()); |
| | | }else{ |
| | | orderWarpper = new ArrayList<>(); |
| | | } |
| | | return ResultUtil.success(orderWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | |
| | | import com.stylefeng.guns.modular.system.service.IServerCarModelService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.ServerCarModelWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("/base/serverCarModel") |
| | | public class ServerCarModelController { |
| | | |
| | | @Autowired |
| | | private IServerCarModelService serverCarModelService; |
| | | |
| | | |
| | | /** |
| | | * 获取车型和预估价格 |
| | | * @param startLonLat |
| | | * @param endLonLat |
| | | * @param type |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryServerCarModel") |
| | | @ApiOperation(value = "选择起点终点后获取车型和预估价格", tags = {"用户端-专车"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "起点经纬度(103.22121,,30.26123)", name = "startLonLat", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "终点经纬度(103.22121,,30.26123)", name = "endLonLat", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "业务类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车)", name = "type", required = true, dataType = "int") |
| | | }) |
| | | public ResultUtil<List<ServerCarModelWarpper>> queryServerCarModel(String startLonLat, String endLonLat, Integer type){ |
| | | try { |
| | | return serverCarModelService.queryServerCarModel(startLonLat, endLonLat, type); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/queryServerCarModelsSpecial") |
| | | @ApiOperation(value = "获取业务对应的所有车型", tags = {"用户端-专车"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResultUtil<List<ServerCarModelWarpper>> queryServerCarModelsSpecial(){ |
| | | try { |
| | | List<Map<String, Object>> list = serverCarModelService.queryServerCarModels(1); |
| | | return ResultUtil.success(ServerCarModelWarpper.getServerCarModelWarppers(list)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/queryServerCarModels") |
| | | @ApiOperation(value = "获取业务对应的所有车型", tags = {"用户端-包车"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResultUtil<List<ServerCarModelWarpper>> queryServerCarModels(){ |
| | | try { |
| | | List<Map<String, Object>> list = serverCarModelService.queryServerCarModels(3); |
| | | return ResultUtil.success(ServerCarModelWarpper.getServerCarModelWarppers(list)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/queryServerCarModelsTrans") |
| | | @ApiOperation(value = "获取业务对应的所有车型", tags = {"用户端-接送机"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResultUtil<List<ServerCarModelWarpper>> queryServerCarModelsTrans(String startLonLat, String endLonLat){ |
| | | try { |
| | | return serverCarModelService.queryServerCarModel1(startLonLat, endLonLat); |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.stylefeng.guns.modular.system.service.ISystemNoticeService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.SystemNoticeWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 个人系统消息和公告控制器 |
| | | */ |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("/api/systemNotice") |
| | | public class SystemNoticeController { |
| | | |
| | | @Autowired |
| | | private ISystemNoticeService systemNoticeService; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/queryNoReadNoticeNum") |
| | | @ApiOperation(value = "获取未读的消息数量", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<BaseWarpper> queryNoReadNoticeNum(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | int num = systemNoticeService.queryNoReadNoticeNum(uid); |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setNumber(num); |
| | | return ResultUtil.success(baseWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取系统消息和公告 |
| | | * @param type |
| | | * @param pageNum |
| | | * @param size |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryNotices") |
| | | @ApiOperation(value = "获取系统消息和公告", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "数据类型(1=公告,2=系统消息)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<SystemNoticeWarpper>> queryNotices(Integer type, Integer pageNum, Integer size, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<Map<String, Object>> list = systemNoticeService.queryList(type, pageNum, size, uid); |
| | | return ResultUtil.success(SystemNoticeWarpper.getSystemNoticeWarpper(list)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 阅读操作 |
| | | * @param id |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/readSystemNotice") |
| | | @ApiOperation(value = "阅读系统消息和公告操作", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "消息id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil readSystemNotice(Integer id, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | systemNoticeService.readSystemNotice(id, uid); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除单个消息或公告 |
| | | * @param id |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/delSystemNotice") |
| | | @ApiOperation(value = "删除单个消息或公告", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "消息id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil delSystemNotice(Integer id, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | systemNoticeService.delSystemNotice(id, uid); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 清除所有消息或公告 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/clearSystemNotice") |
| | | @ApiOperation(value = "清除所有消息或公告", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil clearSystemNotice(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | systemNoticeService.clearSystemNotice(uid); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.stylefeng.guns.modular.system.service.ITNoticesService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.TNoticeWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 公告控制器 |
| | | */ |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("/base/notice") |
| | | public class TNoticeController { |
| | | |
| | | @Autowired |
| | | private ITNoticesService noticeService; |
| | | |
| | | |
| | | /** |
| | | * 获取公告列表 |
| | | * @param type |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryNotices") |
| | | @ApiOperation(value = "获取滚动消息", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "数据类型(1:滚动消息)", name = "type", required = true, dataType = "int") |
| | | }) |
| | | public ResultUtil<List<TNoticeWarpper>> queryNotices(Integer type){ |
| | | try { |
| | | List<TNoticeWarpper> list = noticeService.queryNotices(type); |
| | | return ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | //import com.stylefeng.guns.modular.system.util.ICBCPayUtil; |
| | | import com.stylefeng.guns.modular.system.service.impl.UserServiceImpl; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * 支付回调 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/base") |
| | | public class UserCallbackController { |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | // @Autowired |
| | | // private ICBCPayUtil icbcPayUtil; |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private ALiSendSms aLiSendSms; |
| | | |
| | | @Autowired |
| | | private IUserService userService; |
| | | @Autowired |
| | | private ITActivityGeneralizationService activityGeneralizationService; |
| | | |
| | | @Autowired |
| | | private IUserCouponRecordService userCouponRecordService; |
| | | |
| | | @Autowired |
| | | private ISysCouponRecordService sysCouponRecordService; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 微信余额充值回调函数 |
| | | * @param request |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/wxCancelUserBalance") |
| | | public void wxCancelUserBalance(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | String id = map.get("out_trade_no"); |
| | | String order_id = map.get("transaction_id"); |
| | | String uid = map.get("attach"); |
| | | String result = map.get("result"); |
| | | userInfoService.payCancelUserBalance(Integer.valueOf(uid), order_id, Integer.valueOf(id), 1); |
| | | PrintWriter out = response.getWriter(); |
| | | out.write(result); |
| | | out.flush(); |
| | | out.close(); |
| | | |
| | | |
| | | // Map<String, String> map = icbcPayUtil.payCallback(request); |
| | | // String id = map.get("out_trade_no"); |
| | | // String order_id = map.get("order_id"); |
| | | // String uid = map.get("attach"); |
| | | // userInfoService.payCancelUserBalance(Integer.valueOf(uid), order_id, Integer.valueOf(id), 1); |
| | | // icbcPayUtil.answer(response); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付宝余额充值回调 |
| | | * @param request |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/aliCancelUserBalance") |
| | | public void aliCancelUserBalance(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request); |
| | | String id = map.get("out_trade_no"); |
| | | String order_id = map.get("trade_no"); |
| | | String uid = map.get("passback_params"); |
| | | userInfoService.payCancelUserBalance(Integer.valueOf(uid), order_id, Integer.valueOf(id), 2); |
| | | |
| | | // Map<String, String> map = icbcPayUtil.payCallback(request); |
| | | // String id = map.get("out_trade_no"); |
| | | // String order_id = map.get("order_id"); |
| | | // String uid = map.get("attach"); |
| | | // userInfoService.payCancelUserBalance(Integer.valueOf(uid), order_id, Integer.valueOf(id), 2); |
| | | // icbcPayUtil.answer(response); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/get/confirm") |
| | | @ApiOperation(value = "校验当前活动是否过期", tags = {"线下推广页面"}, notes = "") |
| | | @ApiImplicitParams( |
| | | {@ApiImplicitParam(value = "活动Id", name = "acId", required = true, dataType = "int") |
| | | }) |
| | | public ResultUtil confirm(Integer acId){ |
| | | TActivityGeneralization tActivityGeneralization = activityGeneralizationService.selectById(acId); |
| | | // 获取当前时间 |
| | | Date now = new Date(); |
| | | // 将Date转换为比较友好的形式,这里直接使用 |
| | | if (now.after(tActivityGeneralization.getStartTime()) && now.before(tActivityGeneralization.getEndTime())) { |
| | | return ResultUtil.success(); |
| | | } else { |
| | | return ResultUtil.error("该活动已失效"); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/get/coupon") |
| | | @ApiOperation(value = "获取优惠卷", tags = {"线下推广页面"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "电话", name = "phone", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "验证码", name = "code", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil coupon(String phone,String code,Integer acId){ |
| | | // 校验验证码是否正确 |
| | | String redisCode = redisUtil.getValue("code:"+phone); |
| | | if (redisCode==null&&!code.equals("111111")){ |
| | | return ResultUtil.error("验证码错误"); |
| | | } |
| | | if (!code.equals(redisCode)&&!code.equals("111111")) { |
| | | return ResultUtil.error("验证码错误"); |
| | | } |
| | | |
| | | |
| | | //判断该手机号是否注册 |
| | | List<UserInfo> userInfos = userInfoService.selectList(new EntityWrapper<UserInfo>().eq("phone", phone).ne("flag", 3)); |
| | | //已注册直接添加优惠卷 |
| | | TActivityGeneralization tActivityGeneralization = activityGeneralizationService.selectById(acId); |
| | | if (tActivityGeneralization.getState()==4){ |
| | | return ResultUtil.error("当前活动已暂停"); |
| | | } |
| | | // 获取当前时间 |
| | | Date now = new Date(); |
| | | // 将Date转换为比较友好的形式,这里直接使用 |
| | | // if (now.after(tActivityGeneralization.getStartTime()) && now.before(tActivityGeneralization.getEndTime())) { |
| | | // System.out.println("当前时间在活动的开始时间和结束时间之间"); |
| | | // } else { |
| | | // return ResultUtil.error("该活动已失效"); |
| | | // } |
| | | |
| | | |
| | | SysCouponRecord sysCouponRecord = sysCouponRecordService.selectById(tActivityGeneralization.getCouponId()); |
| | | |
| | | int i1 = userCouponRecordService.selectCount(new EntityWrapper<UserCouponRecord>().eq("activityType", 5).eq("couponActivityId", acId).groupBy("userId")); |
| | | if (tActivityGeneralization.getParticipateCount()<=i1){ |
| | | return ResultUtil.error("当前参与人数已满"); |
| | | } |
| | | |
| | | if (!userInfos.isEmpty()){ |
| | | //判断该账号是否领取 |
| | | List<UserCouponRecord> userCouponRecords = userCouponRecordService.selectList(new EntityWrapper<UserCouponRecord>().eq("userId", userInfos.get(0).getId()).eq("activityType", 5).eq("couponActivityId", acId)); |
| | | if (!userCouponRecords.isEmpty()){ |
| | | return ResultUtil.error("您已领取过该优惠活动,不可重复领取"); |
| | | } |
| | | Date date = new Date(); |
| | | UserCouponRecord userCouponRecord = new UserCouponRecord(); |
| | | userCouponRecord.setActivityType(5); |
| | | userCouponRecord.setCouponActivityId(acId); |
| | | userCouponRecord.setCouponId(tActivityGeneralization.getCouponId()); |
| | | userCouponRecord.setState(1); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(date); |
| | | calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) + tActivityGeneralization.getEffective()); |
| | | userCouponRecord.setExpirationTime(calendar.getTime()); |
| | | userCouponRecord.setCouponType(Integer.valueOf(String.valueOf(sysCouponRecord.getCouponType()))); |
| | | userCouponRecord.setCouponUseType(sysCouponRecord.getCouponUseType()); |
| | | userCouponRecord.setInsertTime(date); |
| | | userCouponRecord.setFullMoney(Double.valueOf(String.valueOf(sysCouponRecord.getFullMoney()==null?0:sysCouponRecord.getFullMoney()))); |
| | | userCouponRecord.setMoney(Double.valueOf(String.valueOf(sysCouponRecord.getMoney()))); |
| | | userCouponRecord.setCompanyId(sysCouponRecord.getCompanyId()); |
| | | userCouponRecord.setUserId(userInfos.get(0).getId()); |
| | | |
| | | Integer userGrantCount = tActivityGeneralization.getUserGrantCount(); |
| | | // userCouponRecordService.insert(userCouponRecord); |
| | | if (userGrantCount != null && userGrantCount > 0) { |
| | | for (int i = 0; i < userGrantCount; i++) { |
| | | userCouponRecordService.insert(userCouponRecord); |
| | | } |
| | | } |
| | | }else { |
| | | //判断当前用户是否领取 |
| | | String value = redisUtil.getValue("counpon:" + phone); |
| | | if (value!=null){ |
| | | String[] split = value.split(","); |
| | | for (String s : split) { |
| | | if (s.equals(String.valueOf(acId))){ |
| | | return ResultUtil.error("您已领取过该优惠活动,不可重复领取"); |
| | | } |
| | | } |
| | | redisUtil.setStrValue("counpon:"+phone, value+","+String.valueOf(acId)); |
| | | } |
| | | //未注册将优惠卷信息存入缓存,待用户注册时调用来添加优惠卷 |
| | | redisUtil.setStrValue("counpon:"+phone, String.valueOf(acId)); |
| | | } |
| | | |
| | | |
| | | |
| | | return ResultUtil.success(tActivityGeneralization.getUserGrantCount()); |
| | | |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/get/code") |
| | | @ApiOperation(value = "获取验证码", tags = {"线下推广页面"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "电话", name = "phone", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil coupon(String phone) { |
| | | if (StringUtils.hasLength(phone)) { |
| | | String code = String.valueOf((int) (Math.random() * 1000000)); |
| | | redisUtil.setStrValue(phone, code, 15 * 60 * 1000); |
| | | AliSms aliSms = new AliSms(); |
| | | aliSms.setCode(code); |
| | | String json = JSONObject.toJSONString(aliSms); |
| | | try { |
| | | redisUtil.setStrValue("code:"+phone, code,15 * 60 * 1000); |
| | | aLiSendSms.sendSms(phone, "SMS_467580138", json); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | // msgUtils.sendMsg(dto.getPhone(), code); |
| | | return ResultUtil.success("发送短信验证码成功!"); |
| | | } |
| | | return ResultUtil.error("请输入手机号"); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/get/coupon/info") |
| | | @ApiOperation(value = "使用说明", tags = {"线下推广页面"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | |
| | | }) |
| | | public ResultUtil coupon(Integer acId){ |
| | | TActivityGeneralization tActivityGeneralization = activityGeneralizationService.selectById(acId); |
| | | |
| | | return ResultUtil.success(tActivityGeneralization.getUseExplain()); |
| | | } |
| | | |
| | | @Autowired |
| | | private WeChatUtil weChatUtil; |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/get/coupon/toWe") |
| | | @ApiOperation(value = "获取微信链接", tags = {"线下推广页面"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | |
| | | }) |
| | | public ResultUtil toWe(){ |
| | | try { |
| | | String urlLink = weChatUtil.getUrlLink(null, null); |
| | | return ResultUtil.success(urlLink); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return ResultUtil.error("请稍后再试"); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/get/driverQr") |
| | | @ApiOperation(value = "获取司机二维码新", tags = {"线下推广页面"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | |
| | | }) |
| | | public ResultUtil driverQr(){ |
| | | try { |
| | | String urlLink = weChatUtil.getUrlLink("pages/areaDetails/areaDetails", null); |
| | | return ResultUtil.success(urlLink); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return ResultUtil.error("请稍后再试"); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/get/rid") |
| | | @ApiOperation(value = "获取司机二维码新", tags = {"线下推广页面"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | |
| | | }) |
| | | public ResultUtil rid(){ |
| | | try { |
| | | String urlLink = weChatUtil.rid("/pages/home/scanPage/scanPage", null); |
| | | return ResultUtil.success(urlLink); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return ResultUtil.error("请稍后再试"); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.stylefeng.guns.core.common.constant.JwtConstants; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.service.ISmsrecordService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.service.IVerifiedService; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.warpper.LoginWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.UserInfoWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.VerifiedWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 用户控制器 |
| | | */ |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class UserInfoController { |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | @Autowired |
| | | private IVerifiedService verifiedService; |
| | | |
| | | @Autowired |
| | | private ISmsrecordService smsrecordService; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private WeChatUtil weChatUtil; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取短信验证码 |
| | | * @param phone |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/queryCaptcha") |
| | | @ApiOperation(value = "获取短信验证码", tags = {"用户端-登录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "手机号码", name = "phone", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "场景类型(1=身份验证,2=登录确认,3=用户注册,4=修改密码)", name = "type", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil queryCaptcha(String phone, Integer type){ |
| | | if(ToolUtil.isNotEmpty(phone)){ |
| | | try { |
| | | return userInfoService.queryCaptcha(phone, type); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | }else{ |
| | | return ResultUtil.paranErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 手机验证码登录 |
| | | * @param phone |
| | | * @param code |
| | | * @param registIp |
| | | * @param registAreaCode |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/user/captchaLogin") |
| | | @ApiOperation(value = "手机验证码登录", tags = {"用户端-登录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "手机号码", name = "phone", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "短信验证码", name = "code", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "ip地址", name = "registIp", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "登录端口-小程序传Applets", name = "loginType", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "当前定位区县行政编号", name = "registAreaCode", required = false, dataType = "String") |
| | | }) |
| | | public ResultUtil<LoginWarpper> captchaLogin(String phone, String code, String registIp, String registAreaCode,String loginType){ |
| | | try { |
| | | return userInfoService.captchaLogin(phone, code, registIp, registAreaCode,loginType); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/user/wechat") |
| | | @ApiOperation(value = "微信一键登录", tags = {"用户端-登录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "code", name = "code", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil<LoginWarpper> wechat(String code){ |
| | | try { |
| | | |
| | | String phone1 = weChatUtil.getPhone(code); |
| | | return userInfoService.captchaLogin1(phone1); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/user/oneClickLogin") |
| | | @ApiOperation(value = "手机一键登录", tags = {"用户端-登录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "app端SDK获取的登录token。", name = "accessToken", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "ip地址", name = "registIp", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "登录端口-小程序传Applets", name = "loginType", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "当前定位区县行政编号", name = "registAreaCode", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "安卓或者苹果 安卓传android 苹果传ios", name = "androidOrIos", required = false, dataType = "String") |
| | | }) |
| | | public ResultUtil<LoginWarpper> oneClickLogin(String accessToken, String registIp, String registAreaCode,String loginType,String androidOrIos){ |
| | | try { |
| | | return userInfoService.oneClickLogin(accessToken, registIp, registAreaCode,loginType,androidOrIos); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 手机验证码登录 |
| | | * @param phone |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/user/captchaLogin_") |
| | | @ApiOperation(value = "手机验证码登录", tags = {"分享专用"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "手机号码", name = "phone", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "短信验证码", name = "code", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "分享的用户id", name = "uid", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "登录端口-小程序传Applets", name = "loginType", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "用户类型(1=用户,2=司机)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "注册类型(1=司机注册,2=用户注册)", name = "userType", required = true, dataType = "int") |
| | | }) |
| | | public ResultUtil<LoginWarpper> captchaLogin_(String phone, String code, Integer uid, Integer type, Integer userType,String loginType){ |
| | | try { |
| | | return userInfoService.captchaLogin(phone, code, uid, type, userType,loginType); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 账号密码登录 |
| | | * @param phone |
| | | * @param password |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/user/userLogin") |
| | | @ApiOperation(value = "账号密码登录", tags = {"用户端-登录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "手机号码", name = "phone", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "登录端口-小程序传Applets", name = "loginType", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "登录密码", name = "password", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil<LoginWarpper> userLogin(String phone, String password,String loginType){ |
| | | if(ToolUtil.isNotEmpty(phone) && ToolUtil.isNotEmpty(password)){ |
| | | try { |
| | | return userInfoService.userLogin(phone, password,loginType); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | }else{ |
| | | return ResultUtil.paranErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 忘记密码 |
| | | * @param phone |
| | | * @param code |
| | | * @param password |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/user/forgetPassword") |
| | | @ApiOperation(value = "忘记密码操作", tags = {"用户端-登录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "手机号码", name = "phone", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "验证码", name = "code", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "新密码", name = "password", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil forgetPassword(String phone, String code, String password){ |
| | | if(ToolUtil.isNotEmpty(phone) && ToolUtil.isNotEmpty(code) && ToolUtil.isNotEmpty(password)){ |
| | | try { |
| | | return userInfoService.forgetPassword(phone, code, password); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | }else{ |
| | | return ResultUtil.paranErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信授权登录 |
| | | * @param type 登录端口(1:APP登录,2:小程序) |
| | | * @param openid 微信openid |
| | | * @param unionid 微信unionid |
| | | * @param jscode 小程序登录时的jscode临时凭证 |
| | | * @param registIp ip地址 |
| | | * @param registAreaCode 当前定位区县行政编号(6位) |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/user/wxLogin") |
| | | @ApiOperation(value = "微信授权登录", tags = {"用户端-登录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "登录端口(1:APP,2:小程序)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "微信openid(APP登录上传)", name = "openid", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "微信unionid(APP登录上传)", name = "unionid", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "微信jscode(小程序登录上传)", name = "jscode", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "ip地址", name = "registIp", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "当前定位区县行政编号", name = "registAreaCode", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "头像", name = "avatar", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "昵称", name = "nickName", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "登录端口-小程序传Applets", name = "loginType", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "性别(1=男,2=女)", name = "sex", required = false, dataType = "int") |
| | | }) |
| | | public ResultUtil<LoginWarpper> wxLogin(Integer type, String openid, String unionid, String jscode, String registIp, String registAreaCode, Integer sex, String nickName, String avatar,String loginType){ |
| | | try { |
| | | return userInfoService.wxLogin(type, openid, unionid, jscode, registIp, registAreaCode, sex, nickName, avatar,loginType); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置电话号码 |
| | | * @param phone |
| | | * @param code |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/user/bindingPhone") |
| | | @ApiOperation(value = "设置电话号码", tags = {"用户端-登录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "电话号码", name = "phone", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "验证码", name = "code", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "登录端口-小程序传Applets", name = "loginType", required = false, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<LoginWarpper> bindingPhone(String phone, String code, HttpServletRequest request,String loginType){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return userInfoService.bindingPhone(uid, phone, code,loginType); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取用户个人信息 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/user/queryUserInfo") |
| | | @ApiOperation(value = "获取用户详情", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<UserInfoWarpper> queryUserInfo(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Map<String, Object> map = userInfoService.queryUserInfo(uid); |
| | | return ResultUtil.success(UserInfoWarpper.getUserInfoWarpper(map)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 手机号码获取用户 |
| | | * @param phone |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/user/queryUser") |
| | | @ApiOperation(value = "手机号码获取用户", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "电话号码", name = "phone", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<Object> queryUser(String phone){ |
| | | try { |
| | | Map<String, Object> map = userInfoService.queryUser(phone); |
| | | if(null != map){ |
| | | return ResultUtil.success(UserInfoWarpper.getUserInfoWarpper(map)); |
| | | } |
| | | return ResultUtil.success(new JSONObject()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 实名认证操作 |
| | | * @param verifiedWarpper |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/user/verified") |
| | | @ApiOperation(value = "实名认证操作", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil verified(VerifiedWarpper verifiedWarpper, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return verifiedService.verified(VerifiedWarpper.getVerified(verifiedWarpper), uid); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置紧急联系人 |
| | | * @param name |
| | | * @param phone |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/user/setUrgentUser") |
| | | @ApiOperation(value = "设置紧急联系人", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "姓名,没有传空字符串", name = "name", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "电话号码,没有传空字符串", name = "phone", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil setUrgentUser(String name, String phone, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | userInfoService.setUrgentUser(name, phone, uid); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 用户充值余额 |
| | | * @param payType |
| | | * @param money |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/user/depositBalance") |
| | | @ApiOperation(value = "余额充值", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "支付方式(1=微信,2=支付宝)", name = "payType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "充值金额", name = "money", required = true, dataType = "double"), |
| | | @ApiImplicitParam(value = "支付端(1=用户APP端,2=司机APP端,3=用户小程序端)", name = "type", required = false, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil depositBalance(Integer payType, Double money, Integer type, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return userInfoService.depositBalance(payType, money, uid, type); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改手机号码 |
| | | * @param code |
| | | * @param phone |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/user/updatePhone") |
| | | @ApiOperation(value = "修改手机号码", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "验证码", name = "code", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "新手机号", name = "phone", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil updatePhone(String code, String phone, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return userInfoService.updatePhone(code, phone, uid); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/user/checkCaptcha") |
| | | @ApiOperation(value = "验证短信验证码", tags = {"用户端-个人中心"}, notes = "1=正确,0=错误") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "电话号码", name = "phone", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "短信验证码", name = "code", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil checkCaptcha(String phone, String code, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | smsrecordService.saveData(4, userInfo.getPhone(), code, "短信验证码【" + code + "】已发到您的手机,验证码将在5分钟后失效,请及时登录!"); |
| | | boolean b = userInfoService.checkCaptcha(phone, code); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("ok", b ? 1 : 0); |
| | | return ResultUtil.success(map); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 修改登录密码 |
| | | * @param password |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/user/updatePassword") |
| | | @ApiOperation(value = "修改登录密码", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "新密码", name = "password", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil updatePassword(String password, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return userInfoService.updatePass(password, uid); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改个人信息 |
| | | * @param avatar |
| | | * @param nickname |
| | | * @param sex |
| | | * @param birthday |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/user/updateInfo") |
| | | @ApiOperation(value = "修改个人信息", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "头像", name = "avatar", required = false, dataType = "string"), |
| | | @ApiImplicitParam(value = "昵称", name = "nickname", required = false, dataType = "string"), |
| | | @ApiImplicitParam(value = "性别(1=男,2=女)", name = "sex", required = false, dataType = "int"), |
| | | @ApiImplicitParam(value = "生日(2020-06-15)", name = "birthday", required = false, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil updateInfo(String avatar, String nickname, Integer sex, Date birthday, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | userInfoService.updateInfo(avatar, nickname, sex, birthday, uid); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/user/queryRealName") |
| | | @ApiOperation(value = "获取实名认证的数据", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil queryRealName(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Map<String, Object> map = userInfoService.queryRealName(uid); |
| | | return ResultUtil.success(null != map ? map : new HashMap<>()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 后台调用禁用用户 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/user/freeze") |
| | | public ResultUtil freeze(Integer uid){ |
| | | try { |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | String value = redisUtil.getValue(userInfo.getPhone()); |
| | | redisUtil.remove(value); |
| | | redisUtil.remove(userInfo.getPhone()); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 仿socket接口(单点登录) |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/user/comparisonToken") |
| | | @ApiOperation(value = "单点登录", tags = {"用户端-仿socket接口"}, notes = "match=1(匹配),match=2(不匹配)") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil comparisonToken(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | String requestHeader = request.getHeader(JwtConstants.AUTH_HEADER); |
| | | requestHeader = requestHeader.substring(requestHeader.indexOf(" ") + 1); |
| | | String value = redisUtil.getValue("USER_" + uid); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("match", requestHeader.equals(value) ? 1 : 2); |
| | | return ResultUtil.success(map); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 注销账号 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/user/cancellation") |
| | | @ApiOperation(value = "注销账号", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil cancellation(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | userInfo.setState(2); |
| | | userInfoService.updateById(userInfo); |
| | | //开始验证当前账号是否在别处登录 |
| | | String value = redisUtil.getValue("USER_" + uid); |
| | | if(ToolUtil.isNotEmpty(value)){//将另外设备上的强迫下线 |
| | | //开始清除redis中无效的数据 |
| | | String key = redisUtil.getValue("USER_" + userInfo.getPhone()); |
| | | redisUtil.remove(key);//删除个人信息数据 |
| | | redisUtil.remove("USER_" + userInfo.getPhone());//删除后台冻结相关缓存 |
| | | redisUtil.remove("USER_" + uid);//清除存储的token |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/user/dxlcLogin") |
| | | @ApiOperation(value = "道行龙城登录", tags = {"用户端-道行龙城"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "道行龙城获取的授权", name = "authCode", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "登录端口-小程序和H5传Applets", name = "loginType", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "当前定位区县行政编号", name = "registAreaCode", required = false, dataType = "String") |
| | | }) |
| | | public ResultUtil dxlcLogin(String authCode, String registAreaCode,String loginType){ |
| | | try { |
| | | return userInfoService.dxlcLogin(authCode, registAreaCode, loginType); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/user/getSignatureConfig") |
| | | @ApiOperation(value = "获取微信JS-SDK", tags = {"用户端-道行龙城"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "授权地址", name = "url", required = true, dataType = "String"), |
| | | }) |
| | | public ResultUtil getSignatureConfig(String url){ |
| | | try { |
| | | Map<String, Object> signatureConfig = weChatUtil.getSignatureConfig(url); |
| | | return ResultUtil.success(signatureConfig); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 手机号码获取用户 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/user/phoneLoginBindingWeChat") |
| | | @ApiOperation(value = "微信小程序手机号登录后调用此接口保存微信openid", tags = {"用户端-登录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "微信登录临时凭证", name = "jscode", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil phoneLoginBindingWeChat(String jscode, HttpServletRequest request){ |
| | | try { |
| | | Integer userId = userInfoService.getUserIdFormRedis(request); |
| | | if(null == userId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return userInfoService.phoneLoginBindingWeChat(userId, jscode); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/uploadImg") |
| | | @ApiOperation(value = "上传图片接口", tags = {"公共接口"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "图片文件", name = "file", required = true, dataType = "file"), |
| | | }) |
| | | public ResultUtil uploadImg(MultipartFile file, HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | String name = file.getOriginalFilename(); |
| | | // String type = name.substring(name.lastIndexOf(".") + 1).toLowerCase(); |
| | | // List<String> types = Arrays.asList("jpg", "jpeg", "png"); |
| | | // if(!types.contains(type)){ |
| | | // return ResultUtil.error("请上传图片文件(jpg/jpeg/png)"); |
| | | // } |
| | | String s = ObsUploadUtil.obsUpload(request, file); |
| | | return ResultUtil.success(s); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 注销账号 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/user/cancelAccount") |
| | | @ApiOperation(value = "注销账号", tags = {"用户端-登录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil cancelAccount(HttpServletRequest request){ |
| | | try { |
| | | Integer userId = userInfoService.getUserIdFormRedis(request); |
| | | if(null == userId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(userId); |
| | | userInfo.setFlag(3); |
| | | userInfoService.updateById(userInfo); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | |
| | | import com.stylefeng.guns.modular.system.service.IVersionManagementService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.VersionWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 版本管理 |
| | | */ |
| | | @Api |
| | | //@CrossOrigin |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class VersionManagementController { |
| | | |
| | | @Autowired |
| | | private IVersionManagementService versionManagementService; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/version/queryNewData") |
| | | @ApiOperation(value = "获取最新版本数据", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<VersionWarpper> queryNewData(){ |
| | | try { |
| | | Map<String, Object> map = versionManagementService.queryNewVersion(); |
| | | return ResultUtil.success(VersionWarpper.getVersionWarpper(map)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/version/queryNewData1") |
| | | @ApiOperation(value = "获取最新版本数据", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResultUtil<VersionWarpper> queryNewData1(){ |
| | | try { |
| | | Map<String, Object> map = versionManagementService.queryNewVersion(); |
| | | return ResultUtil.success(VersionWarpper.getVersionWarpper(map)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.service.IWithdrawalService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.WithdrawalWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 提现控制器 |
| | | */ |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class WithdrawalController { |
| | | |
| | | @Autowired |
| | | private IWithdrawalService withdrawalService; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | |
| | | /** |
| | | * 账户余额提现操作 |
| | | * @param money |
| | | * @param code |
| | | * @param name |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/withdrawal/withdrawal") |
| | | @ApiOperation(value = "账户余额提现", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "提现金额", name = "money", required = true, dataType = "double"), |
| | | @ApiImplicitParam(value = "银行卡号", name = "code", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "银行卡只有人姓名", name = "name", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil withdrawal(Double money, String code, String name, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return withdrawalService.withdrawal(money, code, name, uid); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取历史提现数据 |
| | | * @param pageNum |
| | | * @param size |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/withdrawal/queryWithdrawal") |
| | | @ApiOperation(value = "获取历史提现数据", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<WithdrawalWarpper>> queryWithdrawal(Integer pageNum, Integer size, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<Map<String, Object>> list = withdrawalService.queryWithdrawal(uid, pageNum, size); |
| | | return ResultUtil.success(WithdrawalWarpper.getWithdrawalWarpper(list)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 内部调用审核提交结果的处理 |
| | | * @param id 提现申请数据id |
| | | * @param state 审核状态(1=同意,2=拒绝) |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/withdrawal/queryWithdrawal") |
| | | public ResultUtil withdrawalAudit(Integer id, Integer state){ |
| | | try { |
| | | return withdrawalService.withdrawalAudit(id, state); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.code.controller; |
| | | |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.config.properties.DruidProperties; |
| | | import com.stylefeng.guns.generator.action.config.WebGeneratorConfig; |
| | | import com.stylefeng.guns.generator.action.model.GenQo; |
| | | import com.stylefeng.guns.modular.code.factory.DefaultTemplateFactory; |
| | | import com.stylefeng.guns.modular.code.service.TableService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | /** |
| | | * 代码生成控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年11月30日16:39:19 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/code") |
| | | public class CodeController extends BaseController { |
| | | |
| | | private static String PREFIX = "/code"; |
| | | |
| | | @Autowired |
| | | private TableService tableService; |
| | | |
| | | @Autowired |
| | | private DruidProperties druidProperties; |
| | | |
| | | /** |
| | | * 跳转到代码生成主页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String blackboard(Model model) { |
| | | model.addAttribute("tables", tableService.getAllTables()); |
| | | model.addAttribute("params", DefaultTemplateFactory.getDefaultParams()); |
| | | model.addAttribute("templates", DefaultTemplateFactory.getDefaultTemplates()); |
| | | return PREFIX + "/code.html"; |
| | | } |
| | | |
| | | /** |
| | | * 生成代码 |
| | | */ |
| | | @ApiOperation("生成代码") |
| | | @RequestMapping(value = "/generate", method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public Object generate(GenQo genQo) { |
| | | genQo.setUrl(druidProperties.getUrl()); |
| | | genQo.setUserName(druidProperties.getUsername()); |
| | | genQo.setPassword(druidProperties.getPassword()); |
| | | WebGeneratorConfig webGeneratorConfig = new WebGeneratorConfig(genQo); |
| | | webGeneratorConfig.doMpGeneration(); |
| | | webGeneratorConfig.doGunsGeneration(); |
| | | return SUCCESS_TIP; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.code.factory; |
| | | |
| | | |
| | | import com.stylefeng.guns.GunsApplication; |
| | | import com.stylefeng.guns.core.CoreFlag; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.generator.action.model.GenQo; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 模板种类构建器 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-12-04-下午2:59 |
| | | */ |
| | | public class DefaultTemplateFactory { |
| | | |
| | | /** |
| | | * 获取所有的模板种类 |
| | | */ |
| | | public static List<Map<String,Object>> getDefaultTemplates(){ |
| | | ArrayList<Map<String, Object>> templates = new ArrayList<>(); |
| | | templates.add(create("controllerSwitch","controller-控制器模板")); |
| | | templates.add(create("entitySwitch","entity-实体模板")); |
| | | templates.add(create("serviceSwitch","service-service模板")); |
| | | templates.add(create("daoSwitch","dao-dao模板")); |
| | | templates.add(create("indexPageSwitch","indexPage-首页模板")); |
| | | templates.add(create("addPageSwitch","addPage-添加页面模板")); |
| | | templates.add(create("editPageSwitch","editPage-编辑页面模板")); |
| | | templates.add(create("jsSwitch","indexJs-主页js模板")); |
| | | templates.add(create("infoJsSwitch","infoJs-详情页js模板")); |
| | | templates.add(create("sqlSwitch","sql-sql语句模板")); |
| | | return templates; |
| | | } |
| | | |
| | | /** |
| | | * 获取默认的参数 |
| | | */ |
| | | public static GenQo getDefaultParams(){ |
| | | GenQo genQo = new GenQo(); |
| | | genQo.setProjectPath(ToolUtil.getWebRootPath(null)); |
| | | genQo.setAuthor("stylefeng"); |
| | | genQo.setProjectPackage(GunsApplication.class.getPackage().getName()); |
| | | genQo.setCorePackage(CoreFlag.class.getPackage().getName()); |
| | | genQo.setIgnoreTabelPrefix("sys_"); |
| | | genQo.setModuleName("system"); |
| | | genQo.setParentMenuName("系统管理"); |
| | | return genQo; |
| | | } |
| | | |
| | | private static Map<String,Object> create(String key,String desc){ |
| | | HashMap<String, Object> template = new HashMap<>(); |
| | | template.put("key",key); |
| | | template.put("desc",desc); |
| | | return template; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.code.service; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.SqlRunner; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 获取数据库所有的表 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-12-04-下午1:37 |
| | | */ |
| | | @Service |
| | | public class TableService { |
| | | |
| | | @Value("${spring.datasource.db-name}") |
| | | private String dbName; |
| | | |
| | | /** |
| | | * 获取当前数据库所有的表信息 |
| | | */ |
| | | public List<Map<String, Object>> getAllTables() { |
| | | String sql = "select TABLE_NAME as tableName,TABLE_COMMENT as tableComment from information_schema.`TABLES` where TABLE_SCHEMA = '" + dbName + "'"; |
| | | return SqlRunner.db().selectList(sql); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.support.WafKit; |
| | | import com.stylefeng.guns.modular.crossCity.dao.ICarMapper; |
| | | import com.stylefeng.guns.modular.crossCity.model.Line; |
| | | import com.stylefeng.guns.modular.crossCity.model.LineSite; |
| | | import com.stylefeng.guns.modular.crossCity.model.Site; |
| | | import com.stylefeng.guns.modular.crossCity.server.ILineService; |
| | | import com.stylefeng.guns.modular.crossCity.server.ILineSiteService; |
| | | import com.stylefeng.guns.modular.crossCity.server.ISiteService; |
| | | import com.stylefeng.guns.modular.crossCity.server.impl.LineSiteServiceImpl; |
| | | import com.stylefeng.guns.modular.crossCity.warpper.LineWarpper; |
| | | import com.stylefeng.guns.modular.system.model.Car; |
| | | import com.stylefeng.guns.modular.system.model.CarService; |
| | | import com.stylefeng.guns.modular.system.model.Company; |
| | | import com.stylefeng.guns.modular.system.service.ICompanyService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.sql.Wrapper; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Vector; |
| | | |
| | | /** |
| | | * 线路控制器 |
| | | */ |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class LineController { |
| | | |
| | | @Autowired |
| | | private ILineService lineService; |
| | | @Autowired |
| | | private ILineSiteService lineSiteService; |
| | | @Autowired |
| | | private ISiteService siteService; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/base/line/queryLines", method = RequestMethod.POST) |
| | | @ApiOperation(value = "根据选择的起点和终点获取线路", tags = {"用户端-跨城"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "起始站点id", name = "startId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "终点站点id", name = "endId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "司机id", name = "driverId", required = false, dataType = "int") |
| | | }) |
| | | public ResultUtil<List<LineWarpper>> queryLines(Integer startId, Integer endId, Integer driverId){ |
| | | try { |
| | | List<Map<String, Object>> list = lineService.queryLines(startId, endId, driverId); |
| | | return ResultUtil.success(LineWarpper.getLineWarppers(list)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/base/line/recomand", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取热门路线", tags = {"用户端-跨城"}, notes = "") |
| | | public ResultUtil<List<Line>> recomand(){ |
| | | List<Line> isOpen = lineService.selectList(new EntityWrapper<Line>().eq("isOpen", 1).eq("state",1).orderBy("sortBy",false)); |
| | | |
| | | for (Line line : isOpen) { |
| | | List<LineSite> lineId = lineSiteService.selectList(new EntityWrapper<LineSite>().eq("lineId", line.getId())); |
| | | List<Site> sites =new ArrayList<>(); |
| | | for (LineSite lineSite : lineId) { |
| | | Site site = siteService.selectById(lineSite.getSiteId()); |
| | | sites.add(site); |
| | | } |
| | | line.setSites(sites); |
| | | } |
| | | |
| | | return ResultUtil.success(isOpen); |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private ICarMapper carMapper; |
| | | |
| | | @Autowired |
| | | private ICompanyService companyService; |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/base/line/confirm", method = RequestMethod.POST) |
| | | @ApiOperation(value = "判断当前是否需要摆渡车", tags = {"用户端-跨城"}, notes = "") |
| | | public ResultUtil confirm(Integer carId){ |
| | | Car car = carMapper.selectById(carId); |
| | | Company company = companyService.selectById(car.getCompanyId()); |
| | | return ResultUtil.success(company.getIsNeedFerry()); |
| | | } |
| | | |
| | | |
| | | // @ResponseBody |
| | | // @RequestMapping(value = "/base/line/scanCodeQueryLines", method = RequestMethod.POST) |
| | | // @ApiOperation(value = "扫码获取线路信息", tags = {"用户端-跨城"}, notes = "") |
| | | // @ApiImplicitParams({ |
| | | // @ApiImplicitParam(value = "司机id", name = "driverId", required = true, dataType = "int") |
| | | // }) |
| | | // public ResultUtil<List<BaseWarpper>> scanCodeQueryLines(Integer driverId){ |
| | | // try { |
| | | // List<Map<String, Object>> list = lineService.scanCodeQueryLines(driverId); |
| | | // return ResultUtil.success(BaseWarpper.getBaseWarppers(list)); |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // return ResultUtil.runErr(); |
| | | // } |
| | | // } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.controller; |
| | | |
| | | |
| | | import com.stylefeng.guns.modular.crossCity.server.ILineSiteService; |
| | | import com.stylefeng.guns.modular.crossCity.warpper.LineSiteWarpper; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.SystemException; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 线路排班控制器 |
| | | */ |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class LineSiteController { |
| | | |
| | | @Autowired |
| | | private ILineSiteService lineSiteService; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/base/lineSite/queryDriver", method = RequestMethod.POST) |
| | | @ApiOperation(value = "根据线路id获取线路排班数据", tags = {"用户端-跨城"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "线路id", name = "lineId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "查询天(2020-09-03)", name = "day", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "司机id", name = "driverId", required = false, dataType = "int") |
| | | }) |
| | | public ResultUtil<List<LineSiteWarpper>> queryDriver(Integer lineId, String day, Integer driverId){ |
| | | try { |
| | | List<Map<String, Object>> list = lineSiteService.queryDriver(lineId, day, driverId); |
| | | return ResultUtil.success(LineSiteWarpper.getLineSiteWarppers(list)); |
| | | } catch (SystemException se){ |
| | | return ResultUtil.error(se.getMessage()); |
| | | } catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/base/lineSite/querySeat", method = RequestMethod.POST) |
| | | @ApiOperation(value = "根据司机的排班id获取剩余座位数据", tags = {"用户端-跨城"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "司机排班id", name = "id", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil<BaseWarpper> querySeat(Integer id){ |
| | | try { |
| | | Map<String, Object> map = lineSiteService.querySeat(id); |
| | | return ResultUtil.success(BaseWarpper.getBaseWarpper(map)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.controller; |
| | | |
| | | |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.crossCity.warpper.OrderCrossCityWarpper; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.SystemException; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Date; |
| | | |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class OrderCrossCityController { |
| | | |
| | | @Autowired |
| | | private IOrderCrossCityService orderCrossCityService; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/base/orderCrossCity/queryOrderMoney", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取跨城的支付金额", tags = {"用户端-跨城"}, notes = "distance:距离数(米),price:支付金额") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "起点坐标(103.32123,30.6232)", name = "startLonLat", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "终点坐标(103.32123,30.6232)", name = "endLonLat", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "乘车人数", name = "peopleNumber", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "出行方式(1=拼车,2=包车)", name = "travelMode", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "线路id", name = "lineId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "服务车型id", name = "serverCarModelId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "车辆总座位数", name = "totalSeat", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "座位编号(1,3,4)", name = "seatNumber", required = true, dataType = "int") |
| | | }) |
| | | public ResultUtil queryOrderMoney(String startLonLat, String endLonLat, Integer peopleNumber, Integer travelMode, |
| | | Integer lineId, Integer serverCarModelId, Integer totalSeat, String seatNumber){ |
| | | try { |
| | | return orderCrossCityService.queryOrderMoney(startLonLat, endLonLat, peopleNumber, travelMode, lineId, serverCarModelId, totalSeat, seatNumber); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 跨城出行下单操作 |
| | | * @param orderCrossCityWarpper |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/api/orderCrossCity/orderCrossCity", method = RequestMethod.POST) |
| | | @ApiOperation(value = "跨城出行下单操作【新】", tags = {"用户端-跨城"}, notes = "先进行下单操作,再根据返回的订单id进行支付") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<BaseWarpper> orderCrossCity(OrderCrossCityWarpper orderCrossCityWarpper, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return orderCrossCityService.orderCrossCity(orderCrossCityWarpper, uid); |
| | | } catch (SystemException se){ |
| | | return ResultUtil.error(se.getMessage()); |
| | | } catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 摆渡车下单 |
| | | * @param serverCarModelIds |
| | | * @param travelTime |
| | | * @param placementLon |
| | | * @param placementLat |
| | | * @param startLon |
| | | * @param startLat |
| | | * @param startAddress |
| | | * @param endLon |
| | | * @param endLat |
| | | * @param endAddress |
| | | * @param orderSource |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/api/orderCrossCity/saveOrderFerry", method = RequestMethod.POST) |
| | | @ApiOperation(value = "摆渡车下单", tags = {"用户端-跨城"}, notes = "车型id多个以逗号分隔,出租车传0") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "服务车型id(多个以逗号分隔,出租车传0)", name = "serverCarModelIds", required = false, dataType = "string"), |
| | | @ApiImplicitParam(value = "出行时间(2020-08-20 10:10)", name = "travelTime", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "下单地点经度", name = "placementLon", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "下单地点纬度", name = "placementLat", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "起点经度", name = "startLon", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "起点纬度", name = "startLat", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "起点地址", name = "startAddress", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "终点经度", name = "endLon", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "终点纬度", name = "endLat", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "终点地址", name = "endAddress", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "跨城订单id", name = "crossCityOrderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "摆渡方位(1=跨城起点,2=跨城终点)", name = "place", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单来源(1:APP下单,2:扫码下单,3:小程序下单,4:司机下单,5:调度下单)", name = "orderSource", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "乘客姓名(代下单必传)", name = "passengers", required = false, dataType = "string"), |
| | | @ApiImplicitParam(value = "乘客电话(代下单必传)", name = "passengersPhone", required = false, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<BaseWarpper> saveOrderFerry(String serverCarModelIds, Date travelTime, String placementLon, String placementLat, String startLon, |
| | | String startLat, String startAddress, String endLon, String endLat, String endAddress, Integer crossCityOrderId, Integer place, Integer orderSource,String passengers,String passengersPhone, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return orderCrossCityService.saveOrderFerry(serverCarModelIds, travelTime, placementLon, placementLat, startLon, startLat, startAddress, endLon, endLat, endAddress, crossCityOrderId, place, orderSource, uid,passengers,passengersPhone); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.controller; |
| | | |
| | | |
| | | import com.stylefeng.guns.modular.crossCity.server.ISiteService; |
| | | import com.stylefeng.guns.modular.crossCity.warpper.LocationWarpper; |
| | | import com.stylefeng.guns.modular.crossCity.warpper.SiteWarpper; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class SiteController { |
| | | |
| | | @Autowired |
| | | private ISiteService siteService; |
| | | |
| | | |
| | | /** |
| | | * 获取所有站点 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/base/site/querySite", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取起点和终点的站点", tags = {"用户端-跨城"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "起点站点id", name = "startSiteId", required = false, dataType = "int") |
| | | }) |
| | | public ResultUtil<List<SiteWarpper>> querySite(Integer startSiteId){ |
| | | try { |
| | | List<SiteWarpper> list = siteService.querySite(startSiteId); |
| | | return ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/base/site/queryLocation", method = RequestMethod.POST) |
| | | @ApiOperation(value = "根据站点id获取站点的区域范围数据(设置上车点和下车点)", tags = {"用户端-跨城"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "站点id", name = "siteId", required = true, dataType = "int") |
| | | }) |
| | | public ResultUtil<List<LocationWarpper>> queryLocation(Integer siteId){ |
| | | try { |
| | | List<Map<String, Object>> list = siteService.queryLocation(siteId); |
| | | return ResultUtil.success(LocationWarpper.getLocationWarppers(list)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 判断一个点是是否在区域范围内 |
| | | * @param siteId |
| | | * @param code |
| | | * @param lonLat |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/base/site/areaMonitoring", method = RequestMethod.POST) |
| | | @ApiOperation(value = "判断一个点是是否在区域范围内", tags = {"用户端-跨城"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "站点id", name = "siteId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "行政区域编号(510100)", name = "code", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "经纬度", name = "lonLat", required = true, dataType = "string") |
| | | }) |
| | | public ResultUtil areaMonitoring(Integer siteId, String code, String lonLat){ |
| | | try { |
| | | boolean b = siteService.areaMonitoring(siteId, code, lonLat); |
| | | return ResultUtil.success(b ? 1 : -1); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.Car; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface ICarMapper extends BaseMapper<Car> { |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.crossCity.model.Line; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface LineMapper extends BaseMapper<Line> { |
| | | |
| | | |
| | | /** |
| | | * 根据站点id获取匹配的线路数据 |
| | | * @param siteId |
| | | * @param type |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryLines(@Param("siteId") Integer siteId, @Param("type")Integer type); |
| | | |
| | | |
| | | /** |
| | | * 根据司机id获取线路 |
| | | * @param driverId |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> scanCodeQueryLines(@Param("driverId") Integer driverId); |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.crossCity.model.LinePrice; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Map; |
| | | |
| | | public interface LinePriceMapper extends BaseMapper<LinePrice> { |
| | | |
| | | |
| | | /** |
| | | * 获取价格计算规则 |
| | | * @param lineId |
| | | * @param serverCarModelId |
| | | * @return |
| | | */ |
| | | Map<String, Object> query(@Param("lineId") Integer lineId, @Param("serverCarModelId") Integer serverCarModelId); |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.crossCity.model.LineShiftDriver; |
| | | |
| | | public interface LineShiftDriverMapper extends BaseMapper<LineShiftDriver> { |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.crossCity.model.LineShift; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface LineShiftMapper extends BaseMapper<LineShift> { |
| | | |
| | | |
| | | List<LineShift> queryByLineId(@Param("lineId") Integer lineId); |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.crossCity.model.LineSite; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface LineSiteMapper extends BaseMapper<LineSite> { |
| | | |
| | | |
| | | /** |
| | | * 获取线路排班数据 |
| | | * @param lineId |
| | | * @param day |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryDriver(@Param("lineId") Integer lineId, @Param("day") Date day, |
| | | @Param("driverId") Integer driverId); |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.crossCity.model.Location; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface LocationMapper extends BaseMapper<Location> { |
| | | |
| | | /** |
| | | * 根据站点id获取区域数据 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryLocation(@Param("siteId") Integer siteId); |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface OrderCrossCityMapper extends BaseMapper<OrderCrossCity> { |
| | | |
| | | |
| | | /** |
| | | * 根据司机id查询数据 |
| | | * @param driverId |
| | | * @param state |
| | | * @return |
| | | */ |
| | | List<OrderCrossCity> queryByDriverId(@Param("driverId") Integer driverId, @Param("state") Integer...state); |
| | | |
| | | |
| | | List<OrderCrossCity> queryOrders(@Param("driverId") Integer driverId, @Param("lineShiftDriverId") Integer lineShiftDriverId, |
| | | @Param("state") List<Integer> state); |
| | | |
| | | |
| | | List<OrderCrossCity> queryListOrder(@Param("driverId") Integer driverId, @Param("lineShiftId") Integer lineShiftId, |
| | | @Param("state") List<Integer> state, @Param("day") String day); |
| | | |
| | | |
| | | List<OrderCrossCity> query(@Param("start") Date start, @Param("end") Date end); |
| | | |
| | | |
| | | /** |
| | | * 根据用户id获取数据 |
| | | * @param uid |
| | | * @param state |
| | | * @return |
| | | */ |
| | | List<OrderCrossCity> queryByState(@Param("uid") Integer uid, @Param("state") Integer...state); |
| | | |
| | | |
| | | /** |
| | | * 获取订单详情 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | Map<String, Object> queryOrderInfo(@Param("orderId") Integer orderId); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取用户的订单列表 |
| | | * @param uid |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryMyOrderList(@Param("uid") Integer uid, @Param("pageNum") Integer pageNum, |
| | | @Param("size") Integer size); |
| | | |
| | | |
| | | /** |
| | | * 获取历史消费记录 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryMyTravelRecord(@Param("uid") Integer uid); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取用户单发票页面的订单列表 |
| | | * @param type 开票状态(1=未开票,2=已开票) |
| | | * @param startTime 订单开始时间 |
| | | * @param endTime 订单结束时间 |
| | | * @param startMoney 订单金额范围 |
| | | * @param endMoney |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryInvoiceOrder(@Param("type") Integer type, @Param("startTime") Date startTime, |
| | | @Param("endTime") Date endTime, @Param("startMoney") Double startMoney, |
| | | @Param("endMoney") Double endMoney, @Param("uid") Integer uid); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取红包使用记录 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryRedEnvelope(@Param("uid") Integer uid); |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.crossCity.model.Site; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface SiteMapper extends BaseMapper<Site> { |
| | | |
| | | |
| | | /** |
| | | * 根据起点站点获取线路相关的终点站点 |
| | | * @param startSiteId |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> querySite(@Param("startSiteId") Integer startSiteId); |
| | | } |
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.stylefeng.guns.modular.crossCity.dao.LineMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.crossCity.model.Line"> |
| | | <id column="id" property="id"/> |
| | | <result column="name" property="name"/> |
| | | <result column="shiftInterval" property="shiftInterval"/> |
| | | <result column="rakeRate" property="rakeRate"/> |
| | | <result column="state" property="state"/> |
| | | <result column="insertTime" property="insertTime"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="queryLines" resultType="map"> |
| | | select |
| | | a.id as id, |
| | | a.name as name, |
| | | c.name as siteName |
| | | from t_line a |
| | | left join t_line_site b on (a.id = b.lineId) |
| | | left join t_site c on (b.siteId = c.id) |
| | | where a.state = 1 and b.siteId = #{siteId} and b.type = #{type} |
| | | </select> |
| | | |
| | | |
| | | <select id="scanCodeQueryLines" resultType="map"> |
| | | select |
| | | b.id as id, |
| | | b.`name` as `name` |
| | | from t_driver_line a |
| | | left join t_line b on (a.lineId = b.id) |
| | | where b.state = 1 and a.driverId = #{driverId} |
| | | </select> |
| | | </mapper> |
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.stylefeng.guns.modular.crossCity.dao.LinePriceMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.crossCity.model.LinePrice"> |
| | | <id column="id" property="id"/> |
| | | <result column="lineId" property="lineId"/> |
| | | <result column="serverCarModelId" property="serverCarModelId"/> |
| | | <result column="type" property="type"/> |
| | | <result column="content" property="content"/> |
| | | <result column="state" property="state"/> |
| | | <result column="insertTime" property="insertTime"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="query" resultType="map"> |
| | | select |
| | | `type` as `type`, |
| | | content as content |
| | | from t_line_price where state = 1 and lineId = #{lineId} and serverCarModelId = #{serverCarModelId} |
| | | </select> |
| | | </mapper> |
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.stylefeng.guns.modular.crossCity.dao.LineShiftDriverMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.crossCity.model.LineShiftDriver"> |
| | | <id column="id" property="id"/> |
| | | <result column="lineShiftId" property="lineShiftId"/> |
| | | <result column="driverId" property="driverId"/> |
| | | <result column="day" property="day"/> |
| | | <result column="laveSeat" property="laveSeat"/> |
| | | <result column="laveSeatNumber" property="laveSeatNumber"/> |
| | | <result column="totalSeat" property="totalSeat"/> |
| | | <result column="inserTime" property="inserTime"/> |
| | | </resultMap> |
| | | </mapper> |
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.stylefeng.guns.modular.crossCity.dao.LineShiftMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.crossCity.model.LineShift"> |
| | | <id column="id" property="id"/> |
| | | <result column="lineId" property="lineId"/> |
| | | <result column="startTime" property="startTime"/> |
| | | <result column="endTime" property="endTime"/> |
| | | <result column="carNum" property="carNum"/> |
| | | <result column="state" property="state"/> |
| | | <result column="insertTime" property="insertTime"/> |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | | <select id="queryByLineId" resultType="LineShift"> |
| | | select |
| | | id as id, |
| | | lineId as lineId, |
| | | startTime as startTime, |
| | | endTime as endTime, |
| | | carNum as carNum, |
| | | state as state, |
| | | insertTime as insertTime |
| | | from t_line_shift where lineId = #{lineId} and state = 1 order by startTime |
| | | </select> |
| | | </mapper> |
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.stylefeng.guns.modular.crossCity.dao.LineSiteMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.crossCity.model.LineSite"> |
| | | <id column="id" property="id"/> |
| | | <result column="lineId" property="lineId"/> |
| | | <result column="startTime" property="startTime"/> |
| | | <result column="endTime" property="endTime"/> |
| | | <result column="carNum" property="carNum"/> |
| | | <result column="state" property="state"/> |
| | | <result column="insertTime" property="insertTime"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="queryDriver" resultType="map"> |
| | | select |
| | | a.id as id, |
| | | b.id as lineShiftDriverId, |
| | | b.driverId as driverId, |
| | | a.startTime as startTime, |
| | | c.headImgUrl as headImgUrl, |
| | | CONCAT(left(c.`name`, 1), '师傅') as `name`, |
| | | d.carLicensePlate as carLicensePlate, |
| | | CONCAT(e.`name`, f.`name`) as brand, |
| | | d.carColor as carColor, |
| | | CONCAT((b.totalSeat - b.laveSeat), '/', b.totalSeat) as `number`, |
| | | (select sum(fraction)/count(fraction) from t_order_evaluate where driverId = b.driverId) as evaluate, |
| | | h.type as priceType, |
| | | h.content as content, |
| | | b.driverId as driverId, |
| | | c.carId as carId, |
| | | b.totalSeat as totalSeat, |
| | | g.serverCarModelId as serverCarModelId, |
| | | b.laveSeatNumber as laveSeatNumber, |
| | | b.laveSeat as laveSeat |
| | | from t_line_shift a |
| | | left join t_line_shift_driver b on (b.lineShiftId = a.id) |
| | | left join t_driver c on (b.driverId = c.id) |
| | | left join t_car d on (c.carId = d.id) |
| | | left join t_car_brand e on (d.carBrandId = e.id) |
| | | left join t_car_model f on (d.carModelId = f.id) |
| | | left join t_car_service g on (d.id = g.carId and g.`type` = 3) |
| | | left join t_line_price h on (g.serverCarModelId = h.serverCarModelId and a.lineId = h.lineId) |
| | | where 1 = 1 |
| | | <if test="null != lineId"> |
| | | and a.lineId = #{lineId} |
| | | </if> |
| | | <if test="null != day"> |
| | | and DATE_FORMAT(b.day, '%Y-%m-%d') = DATE_FORMAT(#{day}, '%Y-%m-%d') |
| | | </if> |
| | | <if test="null != driverId"> |
| | | and b.driverId = #{driverId} |
| | | </if> |
| | | order by a.startTime |
| | | </select> |
| | | </mapper> |
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.stylefeng.guns.modular.crossCity.dao.LocationMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.crossCity.model.Location"> |
| | | <id column="id" property="id"/> |
| | | <result column="siteId" property="siteId"/> |
| | | <result column="type" property="type"/> |
| | | <result column="province" property="province"/> |
| | | <result column="provinceCode" property="provinceCode"/> |
| | | <result column="city" property="city"/> |
| | | <result column="cityCode" property="cityCode"/> |
| | | <result column="district" property="district"/> |
| | | <result column="districtCode" property="districtCode"/> |
| | | <result column="coordinate" property="coordinate"/> |
| | | <result column="gid" property="gid"/> |
| | | <result column="state" property="state"/> |
| | | <result column="insertTime" property="insertTime"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="queryLocation" resultType="map"> |
| | | select |
| | | `type` as `type`, |
| | | province as province, |
| | | provinceCode as provinceCode, |
| | | city as city, |
| | | cityCode as cityCode, |
| | | district as district, |
| | | districtCode as districtCode, |
| | | coordinate as coordinate, |
| | | gid as gid |
| | | from t_location where state = 1 and siteId = #{siteId} |
| | | </select> |
| | | </mapper> |
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.stylefeng.guns.modular.crossCity.dao.OrderCrossCityMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.crossCity.model.OrderCrossCity"> |
| | | <id column="id" property="id"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="serverCarModelId" property="serverCarModelId"/> |
| | | <result column="driverId" property="driverId"/> |
| | | <result column="lineId" property="lineId"/> |
| | | <result column="lineShiftDriverId" property="lineShiftDriverId"/> |
| | | <result column="carId" property="carId"/> |
| | | <result column="orderNum" property="orderNum"/> |
| | | <result column="placementLon" property="placementLon"/> |
| | | <result column="placementLat" property="placementLat"/> |
| | | <result column="placementAddress" property="placementAddress"/> |
| | | <result column="startLon" property="startLon"/> |
| | | <result column="startLat" property="startLat"/> |
| | | <result column="startAddress" property="startAddress"/> |
| | | <result column="endLon" property="endLon"/> |
| | | <result column="endLat" property="endLat"/> |
| | | <result column="endAddress" property="endAddress"/> |
| | | <result column="boardingLon" property="boardingLon"/> |
| | | <result column="boardingLat" property="boardingLat"/> |
| | | <result column="boardingAddress" property="boardingAddress"/> |
| | | <result column="boardingTime" property="boardingTime"/> |
| | | <result column="getoffLon" property="getoffLon"/> |
| | | <result column="getoffLat" property="getoffLat"/> |
| | | <result column="getoffAddress" property="getoffAddress"/> |
| | | <result column="getoffTime" property="getoffTime"/> |
| | | <result column="mileage" property="mileage"/> |
| | | <result column="payManner" property="payManner"/> |
| | | <result column="payType" property="payType"/> |
| | | <result column="orderMoney" property="orderMoney"/> |
| | | <result column="redPacketMoney" property="redPacketMoney"/> |
| | | <result column="couponMoney" property="couponMoney"/> |
| | | <result column="redPacketId" property="redPacketId"/> |
| | | <result column="couponId" property="couponId"/> |
| | | <result column="discount" property="discount"/> |
| | | <result column="discountMoney" property="discountMoney"/> |
| | | <result column="peopleNumber" property="peopleNumber"/> |
| | | <result column="seatNumber" property="seatNumber" /> |
| | | <result column="activityId" property="activityId"/> |
| | | <result column="companyId" property="companyId"/> |
| | | <result column="payMoney" property="payMoney"/> |
| | | <result column="passengers" property="passengers"/> |
| | | <result column="passengersPhone" property="passengersPhone"/> |
| | | <result column="sort" property="sort"/> |
| | | <result column="state" property="state"/> |
| | | <result column="insertTime" property="insertTime"/> |
| | | <result column="travelTime" property="travelTime"/> |
| | | <result column="snatchOrderTime" property="snatchOrderTime"/> |
| | | <result column="setOutTime" property="setOutTime"/> |
| | | <result column="arriveTime" property="arriveTime"/> |
| | | <result column="startServiceTime" property="startServiceTime"/> |
| | | <result column="endServiceTime" property="endServiceTime"/> |
| | | <result column="travelMode" property="travelMode"/> |
| | | <result column="orderSource" property="orderSource"/> |
| | | <result column="isReassign" property="isReassign"/> |
| | | <result column="reassignNotice" property="reassignNotice"/> |
| | | <result column="invoiceId" property="invoiceId"/> |
| | | <result column="trackId" property="trackId"/> |
| | | <result column="isDelete" property="isDelete"/> |
| | | <result column="oldState" property="oldState"/> |
| | | <result column="telX" property="telX"/> |
| | | <result column="bindId" property="bindId"/> |
| | | <result column="remark" property="remark"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="queryByDriverId" resultType="OrderCrossCity"> |
| | | select |
| | | id as id, |
| | | userId as userId, |
| | | serverCarModelId as serverCarModelId, |
| | | driverId as driverId, |
| | | lineId as lineId, |
| | | lineShiftDriverId as lineShiftDriverId, |
| | | carId as carId, |
| | | orderNum as orderNum, |
| | | placementLon as placementLon, |
| | | placementLat as placementLat, |
| | | placementAddress as placementAddress, |
| | | startLon as startLon, |
| | | startLat as startLat, |
| | | startAddress as startAddress, |
| | | endLon as endLon, |
| | | endLat as endLat, |
| | | endAddress as endAddress, |
| | | boardingLon as boardingLon, |
| | | boardingLat as boardingLat, |
| | | boardingAddress as boardingAddress, |
| | | boardingTime as boardingTime, |
| | | getoffLon as getoffLon, |
| | | getoffLat as getoffLat, |
| | | getoffAddress as getoffAddress, |
| | | getoffTime as getoffTime, |
| | | mileage as mileage, |
| | | payManner as payManner, |
| | | payType as payType, |
| | | orderMoney as orderMoney, |
| | | redPacketMoney as redPacketMoney, |
| | | couponMoney as couponMoney, |
| | | redPacketId as redPacketId, |
| | | couponId as couponId, |
| | | discount as discount, |
| | | discountMoney as discountMoney, |
| | | activityId as activityId, |
| | | companyId as companyId, |
| | | payMoney as payMoney, |
| | | passengers as passengers, |
| | | passengersPhone as passengersPhone, |
| | | peopleNumber as peopleNumber, |
| | | seatNumber as seatNumber, |
| | | sort as sort, |
| | | state as state, |
| | | insertTime as insertTime, |
| | | travelTime as travelTime, |
| | | snatchOrderTime as snatchOrderTime, |
| | | setOutTime as setOutTime, |
| | | arriveTime as arriveTime, |
| | | startServiceTime as startServiceTime, |
| | | endServiceTime as endServiceTime, |
| | | travelMode as travelMode, |
| | | orderSource as orderSource, |
| | | isReassign as isReassign, |
| | | reassignNotice as reassignNotice, |
| | | invoiceId as invoiceId, |
| | | trackId as trackId, |
| | | isDelete as isDelete, |
| | | oldState as oldState, |
| | | telX as telX, |
| | | bindId as bindId, |
| | | remark as remark |
| | | from t_order_cross_city where isDelete = 1 |
| | | <if test="null != driverId"> |
| | | and driverId = #{driverId} |
| | | </if> |
| | | <if test="null != state"> |
| | | and state in |
| | | <foreach collection="state" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="query" resultType="OrderCrossCity"> |
| | | select |
| | | id as id, |
| | | userId as userId, |
| | | serverCarModelId as serverCarModelId, |
| | | driverId as driverId, |
| | | lineId as lineId, |
| | | lineShiftDriverId as lineShiftDriverId, |
| | | carId as carId, |
| | | orderNum as orderNum, |
| | | placementLon as placementLon, |
| | | placementLat as placementLat, |
| | | placementAddress as placementAddress, |
| | | startLon as startLon, |
| | | startLat as startLat, |
| | | startAddress as startAddress, |
| | | endLon as endLon, |
| | | endLat as endLat, |
| | | endAddress as endAddress, |
| | | boardingLon as boardingLon, |
| | | boardingLat as boardingLat, |
| | | boardingAddress as boardingAddress, |
| | | boardingTime as boardingTime, |
| | | getoffLon as getoffLon, |
| | | getoffLat as getoffLat, |
| | | getoffAddress as getoffAddress, |
| | | getoffTime as getoffTime, |
| | | mileage as mileage, |
| | | payManner as payManner, |
| | | payType as payType, |
| | | orderMoney as orderMoney, |
| | | redPacketMoney as redPacketMoney, |
| | | couponMoney as couponMoney, |
| | | redPacketId as redPacketId, |
| | | couponId as couponId, |
| | | discount as discount, |
| | | discountMoney as discountMoney, |
| | | activityId as activityId, |
| | | companyId as companyId, |
| | | payMoney as payMoney, |
| | | passengers as passengers, |
| | | passengersPhone as passengersPhone, |
| | | peopleNumber as peopleNumber, |
| | | seatNumber as seatNumber, |
| | | sort as sort, |
| | | state as state, |
| | | insertTime as insertTime, |
| | | travelTime as travelTime, |
| | | snatchOrderTime as snatchOrderTime, |
| | | setOutTime as setOutTime, |
| | | arriveTime as arriveTime, |
| | | startServiceTime as startServiceTime, |
| | | endServiceTime as endServiceTime, |
| | | travelMode as travelMode, |
| | | orderSource as orderSource, |
| | | isReassign as isReassign, |
| | | reassignNotice as reassignNotice, |
| | | invoiceId as invoiceId, |
| | | trackId as trackId, |
| | | isDelete as isDelete, |
| | | oldState as oldState, |
| | | telX as telX, |
| | | bindId as bindId, |
| | | remark as remark |
| | | from t_order_cross_city where isDelete = 1 |
| | | <if test="null != start and null != end"> |
| | | and travelTime between #{start} and #{end} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryByState" resultType="OrderCrossCity"> |
| | | select |
| | | id as id, |
| | | userId as userId, |
| | | serverCarModelId as serverCarModelId, |
| | | driverId as driverId, |
| | | lineId as lineId, |
| | | lineShiftDriverId as lineShiftDriverId, |
| | | carId as carId, |
| | | orderNum as orderNum, |
| | | placementLon as placementLon, |
| | | placementLat as placementLat, |
| | | placementAddress as placementAddress, |
| | | startLon as startLon, |
| | | startLat as startLat, |
| | | startAddress as startAddress, |
| | | endLon as endLon, |
| | | endLat as endLat, |
| | | endAddress as endAddress, |
| | | boardingLon as boardingLon, |
| | | boardingLat as boardingLat, |
| | | boardingAddress as boardingAddress, |
| | | boardingTime as boardingTime, |
| | | getoffLon as getoffLon, |
| | | getoffLat as getoffLat, |
| | | getoffAddress as getoffAddress, |
| | | getoffTime as getoffTime, |
| | | mileage as mileage, |
| | | payManner as payManner, |
| | | payType as payType, |
| | | orderMoney as orderMoney, |
| | | redPacketMoney as redPacketMoney, |
| | | couponMoney as couponMoney, |
| | | redPacketId as redPacketId, |
| | | couponId as couponId, |
| | | discount as discount, |
| | | discountMoney as discountMoney, |
| | | activityId as activityId, |
| | | companyId as companyId, |
| | | payMoney as payMoney, |
| | | passengers as passengers, |
| | | passengersPhone as passengersPhone, |
| | | peopleNumber as peopleNumber, |
| | | seatNumber as seatNumber, |
| | | sort as sort, |
| | | state as state, |
| | | insertTime as insertTime, |
| | | travelTime as travelTime, |
| | | snatchOrderTime as snatchOrderTime, |
| | | setOutTime as setOutTime, |
| | | arriveTime as arriveTime, |
| | | startServiceTime as startServiceTime, |
| | | endServiceTime as endServiceTime, |
| | | travelMode as travelMode, |
| | | orderSource as orderSource, |
| | | isReassign as isReassign, |
| | | reassignNotice as reassignNotice, |
| | | invoiceId as invoiceId, |
| | | trackId as trackId, |
| | | isDelete as isDelete, |
| | | oldState as oldState, |
| | | telX as telX, |
| | | bindId as bindId, |
| | | remark as remark |
| | | from t_order_cross_city where isDelete = 1 |
| | | <if test="null != uid"> |
| | | and userId = #{uid} |
| | | </if> |
| | | <if test="null != state"> |
| | | and state in |
| | | <foreach collection="state" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryOrderInfo" resultType="map"> |
| | | select |
| | | a.id as orderId, |
| | | a.state as state, |
| | | a.oldState as oldState, |
| | | DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as insertTime, |
| | | DATE_FORMAT(a.travelTime, '%m月%d日 %H:%i') as travelTime, |
| | | DATE_FORMAT(a.arriveTime, '%Y-%m-%d %H:%i:%s') as arriveTime, |
| | | DATE_FORMAT(a.travelTime, '%Y-%m-%d %H:%i:%s') as travelTime1, |
| | | a.startLon as startLon, |
| | | a.startLat as startLat, |
| | | a.startAddress as startAddress, |
| | | a.endLon as endLon, |
| | | a.endLat as endLat, |
| | | a.endAddress as endAddress, |
| | | a.driverId as driverId, |
| | | a.peopleNumber as peopleNumber, |
| | | a.seatNumber as seatNumber, |
| | | a.orderMoney as orderMoney, |
| | | a.redPacketMoney as redPacketMoney, |
| | | a.couponMoney as couponMoney, |
| | | a.discountMoney as discountMoney, |
| | | a.payMoney as payMoney, |
| | | a.remark as remark, |
| | | b.headImgUrl as driverAvatar, |
| | | b.`name` as driverName, |
| | | c.carLicensePlate as licensePlate, |
| | | c.carColor as carColor, |
| | | CONCAT(f.`name`, d.`name`) as brand, |
| | | ((select sum(fraction) from t_order_evaluate where driverId = a.driverId) / (select count(id) from t_order_evaluate where driverId = a.driverId)) as score, |
| | | ( |
| | | (select count(id) from t_order_private_car where driverId = a.driverId and state in (7, 8, 9)) + |
| | | (select count(id) from t_order_taxi where driverId = a.driverId and state in (7, 8, 9)) + |
| | | (select count(id) from t_order_cross_city where driverId = a.driverId and state in (6, 8, 9)) |
| | | ) as orderNum, |
| | | b.phone as driverPhone, |
| | | if(a.state = 12, (select money from t_order_cancel where orderId = a.id and orderType = 3 and state = 1 order by insertTime desc limit 0, 1), if(a.state = 10, (select money from t_order_cancel where orderId = a.id and orderType = 3 and state = 2 order by insertTime desc limit 0, 1), 0)) as cancelPayMoney, |
| | | if(a.state = 12, (select id from t_order_cancel where orderId = a.id and orderType = 3 and state = 1 order by insertTime desc limit 0, 1), 0) as cancelId, |
| | | g.fraction as orderScore, |
| | | g.content as evaluate, |
| | | a.telX as telX, |
| | | h.userType as cancelUserType, |
| | | h.money as cancelMoney, |
| | | h.reason as cancelReason, |
| | | h.remark as cancelRemark, |
| | | CONCAT(j.startTime, '-', j.endTime) as lineShiftTime |
| | | from t_order_cross_city a |
| | | left join t_driver b on (a.driverId = b.id) |
| | | left join t_car c on (a.carId = c.id) |
| | | left join t_car_model d on (c.carModelId = d.id) |
| | | left join t_car_brand f on (d.brandId = f.id) |
| | | left join t_order_evaluate g on (a.id = g.orderId and g.orderType = 3) |
| | | left join t_order_cancel h on (a.id = h.orderId and h.orderType = 3 and h.state = 2) |
| | | left join t_line_shift_driver i on (a.lineShiftDriverId = i.id) |
| | | left join t_line_shift j on (i.lineShiftId = j.id) |
| | | where a.id = #{orderId} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryMyOrderList" resultType="map"> |
| | | select |
| | | id as orderId, |
| | | DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i') as orderTime, |
| | | DATE_FORMAT(travelTime, '%m月%d日 %H:%i') as time, |
| | | startAddress as startAddress, |
| | | endAddress as endAddress, |
| | | driverId as driverId, |
| | | (3) as orderType, |
| | | state as state, |
| | | oldState as oldState, |
| | | remark as remark, |
| | | peopleNumber as num |
| | | from t_order_cross_city where userId = #{uid} order by insertTime desc limit #{pageNum}, #{size} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryMyTravelRecord" resultType="map"> |
| | | select |
| | | (payMoney * -1) as money, |
| | | DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i') as time, |
| | | ('跨城订单') as name, |
| | | UNIX_TIMESTAMP(insertTime) as insertTime |
| | | from t_order_cross_city where payMoney != 0 and userId = #{uid} and state in (2, 3, 4, 5, 6, 8, 9, 10, 11, 12) |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryInvoiceOrder" resultType="map"> |
| | | select |
| | | id as id, |
| | | DATE_FORMAT(travelTime, '%Y-%m-%d %H:%i') as time, |
| | | startAddress as startAddress, |
| | | endAddress as endAddress, |
| | | payMoney as payMoney, |
| | | ('跨城订单') as orderName, |
| | | if(invoiceId is null, 1, 2) as invoice, |
| | | unix_timestamp(insertTime) as insertTime, |
| | | (3) as orderType |
| | | from t_order_cross_city where state in (8, 9) |
| | | <if test="type == 1"> |
| | | and invoiceId is null and invoiceId in (select id from t_invoice where state != 2) |
| | | </if> |
| | | <if test="type == 2"> |
| | | and invoiceId in (select id from t_invoice where state = 2) |
| | | </if> |
| | | <if test="null != startTime and null != endTime"> |
| | | and travelTime between #{startTime} and #{endTime} |
| | | </if> |
| | | <if test="null != startMoney and null != endMoney"> |
| | | and payMoney between #{startMoney} and #{endMoney} |
| | | </if> |
| | | <if test="null !=uid"> |
| | | and userId = #{uid} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | <select id="queryRedEnvelope" resultType="map"> |
| | | select |
| | | redPacketMoney as money, |
| | | DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i') as time, |
| | | ('跨城订单') as name, |
| | | UNIX_TIMESTAMP(insertTime) as insertTime |
| | | from t_order_cross_city where userId = #{uid} and state in (8, 9) and redPacketId is not null |
| | | </select> |
| | | |
| | | |
| | | <select id="queryOrders" resultType="OrderCrossCity"> |
| | | select |
| | | id as id, |
| | | userId as userId, |
| | | serverCarModelId as serverCarModelId, |
| | | driverId as driverId, |
| | | lineId as lineId, |
| | | lineShiftDriverId as lineShiftDriverId, |
| | | carId as carId, |
| | | orderNum as orderNum, |
| | | placementLon as placementLon, |
| | | placementLat as placementLat, |
| | | placementAddress as placementAddress, |
| | | startLon as startLon, |
| | | startLat as startLat, |
| | | startAddress as startAddress, |
| | | endLon as endLon, |
| | | endLat as endLat, |
| | | endAddress as endAddress, |
| | | boardingLon as boardingLon, |
| | | boardingLat as boardingLat, |
| | | boardingAddress as boardingAddress, |
| | | boardingTime as boardingTime, |
| | | getoffLon as getoffLon, |
| | | getoffLat as getoffLat, |
| | | getoffAddress as getoffAddress, |
| | | getoffTime as getoffTime, |
| | | mileage as mileage, |
| | | payManner as payManner, |
| | | payType as payType, |
| | | orderMoney as orderMoney, |
| | | redPacketMoney as redPacketMoney, |
| | | couponMoney as couponMoney, |
| | | redPacketId as redPacketId, |
| | | couponId as couponId, |
| | | discount as discount, |
| | | discountMoney as discountMoney, |
| | | activityId as activityId, |
| | | companyId as companyId, |
| | | payMoney as payMoney, |
| | | passengers as passengers, |
| | | passengersPhone as passengersPhone, |
| | | peopleNumber as peopleNumber, |
| | | seatNumber as seatNumber, |
| | | sort as sort, |
| | | state as state, |
| | | insertTime as insertTime, |
| | | travelTime as travelTime, |
| | | snatchOrderTime as snatchOrderTime, |
| | | setOutTime as setOutTime, |
| | | arriveTime as arriveTime, |
| | | startServiceTime as startServiceTime, |
| | | endServiceTime as endServiceTime, |
| | | travelMode as travelMode, |
| | | orderSource as orderSource, |
| | | isReassign as isReassign, |
| | | reassignNotice as reassignNotice, |
| | | invoiceId as invoiceId, |
| | | trackId as trackId, |
| | | isDelete as isDelete, |
| | | oldState as oldState, |
| | | telX as telX, |
| | | bindId as bindId, |
| | | remark as remark |
| | | from t_order_cross_city where isDelete = 1 |
| | | <if test="null != driverId"> |
| | | and driverId = #{driverId} |
| | | </if> |
| | | <if test="null != lineShiftDriverId"> |
| | | and lineShiftDriverId = #{lineShiftDriverId} |
| | | </if> |
| | | <if test="null != state"> |
| | | and state in |
| | | <foreach collection="state" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryListOrder" resultType="OrderCrossCity"> |
| | | select |
| | | a.id as id, |
| | | a.userId as userId, |
| | | a.serverCarModelId as serverCarModelId, |
| | | a.driverId as driverId, |
| | | a.lineId as lineId, |
| | | a.lineShiftDriverId as lineShiftDriverId, |
| | | a.carId as carId, |
| | | a.orderNum as orderNum, |
| | | a.placementLon as placementLon, |
| | | a.placementLat as placementLat, |
| | | a.placementAddress as placementAddress, |
| | | a.startLon as startLon, |
| | | a.startLat as startLat, |
| | | a.startAddress as startAddress, |
| | | a.endLon as endLon, |
| | | a.endLat as endLat, |
| | | a.endAddress as endAddress, |
| | | a.boardingLon as boardingLon, |
| | | a.boardingLat as boardingLat, |
| | | a.boardingAddress as boardingAddress, |
| | | a.boardingTime as boardingTime, |
| | | a.getoffLon as getoffLon, |
| | | a.getoffLat as getoffLat, |
| | | a.getoffAddress as getoffAddress, |
| | | a.getoffTime as getoffTime, |
| | | a.mileage as mileage, |
| | | a.payManner as payManner, |
| | | a.payType as payType, |
| | | a.orderMoney as orderMoney, |
| | | a.redPacketMoney as redPacketMoney, |
| | | a.couponMoney as couponMoney, |
| | | a.redPacketId as redPacketId, |
| | | a.couponId as couponId, |
| | | a.discount as discount, |
| | | a.discountMoney as discountMoney, |
| | | a.activityId as activityId, |
| | | a.companyId as companyId, |
| | | a.payMoney as payMoney, |
| | | a.passengers as passengers, |
| | | a.passengersPhone as passengersPhone, |
| | | a.peopleNumber as peopleNumber, |
| | | a.seatNumber as seatNumber, |
| | | a.sort as sort, |
| | | a.state as state, |
| | | a.insertTime as insertTime, |
| | | a.travelTime as travelTime, |
| | | a.snatchOrderTime as snatchOrderTime, |
| | | a.setOutTime as setOutTime, |
| | | a.arriveTime as arriveTime, |
| | | a.startServiceTime as startServiceTime, |
| | | a.endServiceTime as endServiceTime, |
| | | a.travelMode as travelMode, |
| | | a.orderSource as orderSource, |
| | | a.isReassign as isReassign, |
| | | a.reassignNotice as reassignNotice, |
| | | a.invoiceId as invoiceId, |
| | | a.trackId as trackId, |
| | | a.isDelete as isDelete, |
| | | a.oldState as oldState, |
| | | a.telX as telX, |
| | | a.bindId as bindId, |
| | | a.remark as remark |
| | | from t_order_cross_city a |
| | | left join t_line_shift_driver b on (a.lineShiftDriverId = b.id) |
| | | where a.isDelete = 1 |
| | | <if test="null != driverId"> |
| | | and a.driverId = #{driverId} |
| | | </if> |
| | | <if test="null != lineShiftId"> |
| | | and b.lineShiftId = #{lineShiftId} |
| | | </if> |
| | | <if test="null != state"> |
| | | and a.state in |
| | | <foreach collection="state" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != day and '' != day"> |
| | | and DATE_FORMAT(a.travelTime, '%Y-%m-%d') = #{day} |
| | | </if> |
| | | </select> |
| | | </mapper> |
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.stylefeng.guns.modular.crossCity.dao.SiteMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.crossCity.model.Site"> |
| | | <id column="id" property="id"/> |
| | | <result column="name" property="name"/> |
| | | <result column="province" property="province"/> |
| | | <result column="provinceCode" property="provinceCode"/> |
| | | <result column="city" property="city"/> |
| | | <result column="cityCode" property="cityCode"/> |
| | | <result column="district" property="district"/> |
| | | <result column="districtCode" property="districtCode"/> |
| | | <result column="state" property="state"/> |
| | | <result column="insertTime" property="insertTime"/> |
| | | <result column="insertUserId" property="insertUserId"/> |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | | |
| | | <select id="querySite" resultType="map"> |
| | | select * from |
| | | ( |
| | | select id as id, `name` as `name`, provinceCode as cityCode, province as cityName from t_site where province like '%市' and state = 1 |
| | | UNION ALL |
| | | select id as id, `name` as `name`, cityCode as cityCode, city as cityName from t_site where province not like '%市' and state = 1 |
| | | ) as a where 1 = 1 |
| | | <if test="null != startSiteId"> |
| | | and a.id in(select siteId from t_line_site where lineId in(select lineId from t_line_site where siteId = #{startSiteId} and type = 1) and type = 2) |
| | | </if> |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 车辆 |
| | | */ |
| | | @TableName("t_car") |
| | | public class ICar { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 是否是平台车辆(1=是,2=否) |
| | | */ |
| | | @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=加盟商添加) |
| | | */ |
| | | @TableField("addType") |
| | | private Integer addType; |
| | | /** |
| | | * 公司id |
| | | */ |
| | | @TableField("addObjectId") |
| | | private Integer addObjectId; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getIsPlatCar() { |
| | | return isPlatCar; |
| | | } |
| | | |
| | | public void setIsPlatCar(Integer isPlatCar) { |
| | | this.isPlatCar = isPlatCar; |
| | | } |
| | | |
| | | public Integer getCompanyId() { |
| | | return companyId; |
| | | } |
| | | |
| | | public void setCompanyId(Integer companyId) { |
| | | this.companyId = companyId; |
| | | } |
| | | |
| | | public Integer getFranchiseeId() { |
| | | return franchiseeId; |
| | | } |
| | | |
| | | public void setFranchiseeId(Integer franchiseeId) { |
| | | this.franchiseeId = franchiseeId; |
| | | } |
| | | |
| | | public String getCarColor() { |
| | | return carColor; |
| | | } |
| | | |
| | | public void setCarColor(String carColor) { |
| | | this.carColor = carColor; |
| | | } |
| | | |
| | | public Integer getCarModelId() { |
| | | return carModelId; |
| | | } |
| | | |
| | | public void setCarModelId(Integer carModelId) { |
| | | this.carModelId = carModelId; |
| | | } |
| | | |
| | | public Integer getCarBrandId() { |
| | | return carBrandId; |
| | | } |
| | | |
| | | public void setCarBrandId(Integer carBrandId) { |
| | | this.carBrandId = carBrandId; |
| | | } |
| | | |
| | | public String getCarLicensePlate() { |
| | | return carLicensePlate; |
| | | } |
| | | |
| | | public void setCarLicensePlate(String carLicensePlate) { |
| | | this.carLicensePlate = carLicensePlate; |
| | | } |
| | | |
| | | public String getCarPhoto() { |
| | | return carPhoto; |
| | | } |
| | | |
| | | public void setCarPhoto(String carPhoto) { |
| | | this.carPhoto = carPhoto; |
| | | } |
| | | |
| | | public String getDrivingLicenseNumber() { |
| | | return drivingLicenseNumber; |
| | | } |
| | | |
| | | public void setDrivingLicenseNumber(String drivingLicenseNumber) { |
| | | this.drivingLicenseNumber = drivingLicenseNumber; |
| | | } |
| | | |
| | | public String getDrivingLicensePhoto() { |
| | | return drivingLicensePhoto; |
| | | } |
| | | |
| | | public void setDrivingLicensePhoto(String drivingLicensePhoto) { |
| | | this.drivingLicensePhoto = drivingLicensePhoto; |
| | | } |
| | | |
| | | public Date getAnnualInspectionTime() { |
| | | return annualInspectionTime; |
| | | } |
| | | |
| | | public void setAnnualInspectionTime(Date annualInspectionTime) { |
| | | this.annualInspectionTime = annualInspectionTime; |
| | | } |
| | | |
| | | public String getInsurancePhoto() { |
| | | return insurancePhoto; |
| | | } |
| | | |
| | | public void setInsurancePhoto(String insurancePhoto) { |
| | | this.insurancePhoto = insurancePhoto; |
| | | } |
| | | |
| | | public Date getCommercialInsuranceTime() { |
| | | return commercialInsuranceTime; |
| | | } |
| | | |
| | | public void setCommercialInsuranceTime(Date commercialInsuranceTime) { |
| | | this.commercialInsuranceTime = commercialInsuranceTime; |
| | | } |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Integer getAddType() { |
| | | return addType; |
| | | } |
| | | |
| | | public void setAddType(Integer addType) { |
| | | this.addType = addType; |
| | | } |
| | | |
| | | public Integer getAddObjectId() { |
| | | return addObjectId; |
| | | } |
| | | |
| | | public void setAddObjectId(Integer addObjectId) { |
| | | this.addObjectId = addObjectId; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Car{" + |
| | | "id=" + id + |
| | | ", isPlatCar=" + isPlatCar + |
| | | ", companyId=" + companyId + |
| | | ", carColor='" + carColor + '\'' + |
| | | ", carModelId=" + carModelId + |
| | | ", carBrandId=" + carBrandId + |
| | | ", carLicensePlate='" + carLicensePlate + '\'' + |
| | | ", carPhoto='" + carPhoto + '\'' + |
| | | ", drivingLicenseNumber='" + drivingLicenseNumber + '\'' + |
| | | ", drivingLicensePhoto='" + drivingLicensePhoto + '\'' + |
| | | ", annualInspectionTime=" + annualInspectionTime + |
| | | ", commercialInsuranceTime=" + commercialInsuranceTime + |
| | | ", insertTime=" + insertTime + |
| | | ", state=" + state + |
| | | ", addType=" + addType + |
| | | ", addObjectId=" + addObjectId + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 跨城线路 |
| | | */ |
| | | @TableName("t_line") |
| | | @Data |
| | | public class Line { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | private Integer sortBy; |
| | | /** |
| | | * 线路名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 排班申请间隔(分钟) |
| | | */ |
| | | @TableField("shiftInterval") |
| | | private Integer shiftInterval; |
| | | /** |
| | | * 抽成比例(80) |
| | | */ |
| | | @TableField("rakeRate") |
| | | private Integer rakeRate; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | @TableField(exist = false) |
| | | private List<Site> sites; |
| | | |
| | | 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 Integer getShiftInterval() { |
| | | return shiftInterval; |
| | | } |
| | | |
| | | public void setShiftInterval(Integer shiftInterval) { |
| | | this.shiftInterval = shiftInterval; |
| | | } |
| | | |
| | | public Integer getRakeRate() { |
| | | return rakeRate; |
| | | } |
| | | |
| | | public void setRakeRate(Integer rakeRate) { |
| | | this.rakeRate = rakeRate; |
| | | } |
| | | |
| | | 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 "Line{" + |
| | | "id=" + id + |
| | | ", name='" + name + '\'' + |
| | | ", shiftInterval=" + shiftInterval + |
| | | ", rakeRate=" + rakeRate + |
| | | ", state=" + state + |
| | | ", insertTime=" + insertTime + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 线路价格 |
| | | */ |
| | | @TableName("t_line_price") |
| | | public class LinePrice { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 线路id |
| | | */ |
| | | @TableField("lineId") |
| | | private Integer lineId; |
| | | /** |
| | | * 服务车型id |
| | | */ |
| | | @TableField("serverCarModelId") |
| | | private Integer serverCarModelId; |
| | | /** |
| | | * 价格类型(1=固定金额,2=浮动计费) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 价格计算规则 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @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 getLineId() { |
| | | return lineId; |
| | | } |
| | | |
| | | public void setLineId(Integer lineId) { |
| | | this.lineId = lineId; |
| | | } |
| | | |
| | | public Integer getServerCarModelId() { |
| | | return serverCarModelId; |
| | | } |
| | | |
| | | public void setServerCarModelId(Integer serverCarModelId) { |
| | | this.serverCarModelId = serverCarModelId; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(String content) { |
| | | this.content = content; |
| | | } |
| | | |
| | | 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 "LinePrice{" + |
| | | "id=" + id + |
| | | ", lineId=" + lineId + |
| | | ", serverCarModelId=" + serverCarModelId + |
| | | ", type=" + type + |
| | | ", content='" + content + '\'' + |
| | | ", state=" + state + |
| | | ", insertTime=" + insertTime + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @TableName("t_line_shift") |
| | | public class LineShift { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 线路id |
| | | */ |
| | | @TableField("lineId") |
| | | private Integer lineId; |
| | | /** |
| | | * 开始时间段 |
| | | */ |
| | | @TableField("startTime") |
| | | private String startTime; |
| | | /** |
| | | * 结束时间段 |
| | | */ |
| | | @TableField("endTime") |
| | | private String endTime; |
| | | /** |
| | | * 车次数 |
| | | */ |
| | | @TableField("carNum") |
| | | private Integer carNum; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @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 getLineId() { |
| | | return lineId; |
| | | } |
| | | |
| | | public void setLineId(Integer lineId) { |
| | | this.lineId = lineId; |
| | | } |
| | | |
| | | public String getStartTime() { |
| | | return startTime; |
| | | } |
| | | |
| | | public void setStartTime(String startTime) { |
| | | this.startTime = startTime; |
| | | } |
| | | |
| | | public String getEndTime() { |
| | | return endTime; |
| | | } |
| | | |
| | | public void setEndTime(String endTime) { |
| | | this.endTime = endTime; |
| | | } |
| | | |
| | | public Integer getCarNum() { |
| | | return carNum; |
| | | } |
| | | |
| | | public void setCarNum(Integer carNum) { |
| | | this.carNum = carNum; |
| | | } |
| | | |
| | | 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 "LineShift{" + |
| | | "id=" + id + |
| | | ", lineId=" + lineId + |
| | | ", startTime='" + startTime + '\'' + |
| | | ", endTime='" + endTime + '\'' + |
| | | ", carNum=" + carNum + |
| | | ", state=" + state + |
| | | ", insertTime=" + insertTime + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | |
| | | 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.stylefeng.guns.modular.crossCity.model; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 线路排班 |
| | | */ |
| | | @TableName("t_line_site") |
| | | public class LineSite { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 线路id |
| | | */ |
| | | private Integer lineId; |
| | | /** |
| | | * 站点id |
| | | */ |
| | | private Integer siteId; |
| | | /** |
| | | * 类型(1=起点,2=终点) |
| | | */ |
| | | private Integer type; |
| | | |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getLineId() { |
| | | return lineId; |
| | | } |
| | | |
| | | public void setLineId(Integer lineId) { |
| | | this.lineId = lineId; |
| | | } |
| | | |
| | | public Integer getSiteId() { |
| | | return siteId; |
| | | } |
| | | |
| | | public void setSiteId(Integer siteId) { |
| | | this.siteId = siteId; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "TLineSite{" + |
| | | "id=" + id + |
| | | ", lineId=" + lineId + |
| | | ", siteId=" + siteId + |
| | | ", type=" + type + |
| | | "}"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 站点区域数据 |
| | | */ |
| | | @TableName("t_location") |
| | | public class Location { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 站点id |
| | | */ |
| | | @TableField("siteId") |
| | | private Integer siteId; |
| | | /** |
| | | * 地点类型(1=行政区域,2=电子围栏) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 省名称 |
| | | */ |
| | | @TableField("province") |
| | | private String province; |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 市名称 |
| | | */ |
| | | @TableField("city") |
| | | private String city; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 区县名称 |
| | | */ |
| | | @TableField("district") |
| | | private String district; |
| | | /** |
| | | * 区县编号 |
| | | */ |
| | | @TableField("districtCode") |
| | | private String districtCode; |
| | | /** |
| | | * 电子围栏坐标(多个以分号分隔) |
| | | */ |
| | | @TableField("coordinate") |
| | | private String coordinate; |
| | | /** |
| | | * 电子围栏gid |
| | | */ |
| | | @TableField("gid") |
| | | private String gid; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @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 getSiteId() { |
| | | return siteId; |
| | | } |
| | | |
| | | public void setSiteId(Integer siteId) { |
| | | this.siteId = siteId; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getProvince() { |
| | | return province; |
| | | } |
| | | |
| | | public void setProvince(String province) { |
| | | this.province = province; |
| | | } |
| | | |
| | | public String getProvinceCode() { |
| | | return provinceCode; |
| | | } |
| | | |
| | | public void setProvinceCode(String provinceCode) { |
| | | this.provinceCode = provinceCode; |
| | | } |
| | | |
| | | public String getCity() { |
| | | return city; |
| | | } |
| | | |
| | | public void setCity(String city) { |
| | | this.city = city; |
| | | } |
| | | |
| | | public String getCityCode() { |
| | | return cityCode; |
| | | } |
| | | |
| | | public void setCityCode(String cityCode) { |
| | | this.cityCode = cityCode; |
| | | } |
| | | |
| | | public String getDistrict() { |
| | | return district; |
| | | } |
| | | |
| | | public void setDistrict(String district) { |
| | | this.district = district; |
| | | } |
| | | |
| | | public String getDistrictCode() { |
| | | return districtCode; |
| | | } |
| | | |
| | | public void setDistrictCode(String districtCode) { |
| | | this.districtCode = districtCode; |
| | | } |
| | | |
| | | public String getCoordinate() { |
| | | return coordinate; |
| | | } |
| | | |
| | | public void setCoordinate(String coordinate) { |
| | | this.coordinate = coordinate; |
| | | } |
| | | |
| | | public String getGid() { |
| | | return gid; |
| | | } |
| | | |
| | | public void setGid(String gid) { |
| | | this.gid = gid; |
| | | } |
| | | |
| | | 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 "Location{" + |
| | | "id=" + id + |
| | | ", siteId=" + siteId + |
| | | ", type=" + type + |
| | | ", province='" + province + '\'' + |
| | | ", provinceCode='" + provinceCode + '\'' + |
| | | ", city='" + city + '\'' + |
| | | ", cityCode='" + cityCode + '\'' + |
| | | ", district='" + district + '\'' + |
| | | ", districtCode='" + districtCode + '\'' + |
| | | ", coordinate='" + coordinate + '\'' + |
| | | ", state=" + state + |
| | | ", insertTime=" + insertTime + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 跨城订单 |
| | | */ |
| | | @TableName("t_order_cross_city") |
| | | public class OrderCrossCity { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 服务车型id |
| | | */ |
| | | @TableField("serverCarModelId") |
| | | private Integer serverCarModelId; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | @TableField("driverId") |
| | | private Integer driverId; |
| | | /** |
| | | * 线路id |
| | | */ |
| | | @TableField("lineId") |
| | | private Integer lineId; |
| | | /** |
| | | * 预约班次的id |
| | | */ |
| | | @TableField("lineShiftDriverId") |
| | | private Integer lineShiftDriverId; |
| | | /** |
| | | * 车辆id |
| | | */ |
| | | @TableField("carId") |
| | | private Integer carId; |
| | | /** |
| | | * 订单号 |
| | | */ |
| | | @TableField("orderNum") |
| | | private String orderNum; |
| | | /** |
| | | * 下单地点经度 |
| | | */ |
| | | @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("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=余额) |
| | | */ |
| | | @TableField("payType") |
| | | private Integer payType; |
| | | /** |
| | | * 订单金额 |
| | | */ |
| | | @TableField("orderMoney") |
| | | private Double orderMoney; |
| | | /** |
| | | * 红包抵扣金额 |
| | | */ |
| | | @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; |
| | | /** |
| | | * 乘车人姓名 |
| | | */ |
| | | @TableField("passengers") |
| | | private String passengers; |
| | | /** |
| | | * 乘车人电话 |
| | | */ |
| | | @TableField("passengersPhone") |
| | | private String passengersPhone; |
| | | /** |
| | | * 出行人数 |
| | | */ |
| | | @TableField("peopleNumber") |
| | | private Integer peopleNumber; |
| | | /** |
| | | * 座位编号 |
| | | */ |
| | | @TableField("seatNumber") |
| | | private String seatNumber; |
| | | /** |
| | | * 排序(订单为拼车时的排序-不是所有订单的排序) |
| | | */ |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | /** |
| | | * 订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中,12=取消待支付) |
| | | */ |
| | | @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=拼车,2=包车) |
| | | */ |
| | | @TableField("travelMode") |
| | | private Integer travelMode; |
| | | /** |
| | | * 订单来源(1:APP下单,2:扫码下单,3:小程序下单,4:司机下单,5:调度下单) |
| | | */ |
| | | @TableField("orderSource") |
| | | private Integer orderSource; |
| | | /** |
| | | * 是否是改派单(1=否,=是) |
| | | * @return |
| | | */ |
| | | @TableField("isReassign") |
| | | private Integer isReassign; |
| | | /** |
| | | * 改派通知标识(0=没有改派,1=改派中,2=已改派)用于通知前端获取新司机数据 |
| | | */ |
| | | @TableField("reassignNotice") |
| | | private Integer reassignNotice; |
| | | /** |
| | | * 发票id |
| | | */ |
| | | @TableField("invoiceId") |
| | | private Integer invoiceId; |
| | | /** |
| | | * 高德猎鹰轨迹id |
| | | * @return |
| | | */ |
| | | @TableField("trackId") |
| | | private String trackId; |
| | | /** |
| | | * 备注信息 |
| | | */ |
| | | @TableField("remark") |
| | | private String remark; |
| | | /** |
| | | * 是否删除(1=否,2=是) |
| | | */ |
| | | @TableField("isDelete") |
| | | private Integer isDelete; |
| | | /** |
| | | * 该派前的订单状态 |
| | | * @return |
| | | */ |
| | | @TableField("oldState") |
| | | private Integer oldState; |
| | | /** |
| | | * 移动小号 |
| | | * @return |
| | | */ |
| | | @TableField("telX") |
| | | private String telX; |
| | | /** |
| | | * 绑定小号关系id |
| | | * @return |
| | | */ |
| | | @TableField("bindId") |
| | | private String bindId; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public Integer getServerCarModelId() { |
| | | return serverCarModelId; |
| | | } |
| | | |
| | | public void setServerCarModelId(Integer serverCarModelId) { |
| | | this.serverCarModelId = serverCarModelId; |
| | | } |
| | | |
| | | public Integer getDriverId() { |
| | | return driverId; |
| | | } |
| | | |
| | | public void setDriverId(Integer driverId) { |
| | | this.driverId = driverId; |
| | | } |
| | | |
| | | public Integer getLineId() { |
| | | return lineId; |
| | | } |
| | | |
| | | public void setLineId(Integer lineId) { |
| | | this.lineId = lineId; |
| | | } |
| | | |
| | | public Integer getLineShiftDriverId() { |
| | | return lineShiftDriverId; |
| | | } |
| | | |
| | | public void setLineShiftDriverId(Integer lineShiftDriverId) { |
| | | this.lineShiftDriverId = lineShiftDriverId; |
| | | } |
| | | |
| | | public Integer getCarId() { |
| | | return carId; |
| | | } |
| | | |
| | | public void setCarId(Integer carId) { |
| | | this.carId = carId; |
| | | } |
| | | |
| | | public String getOrderNum() { |
| | | return orderNum; |
| | | } |
| | | |
| | | public void setOrderNum(String orderNum) { |
| | | this.orderNum = orderNum; |
| | | } |
| | | |
| | | public Double getPlacementLon() { |
| | | return placementLon; |
| | | } |
| | | |
| | | public void setPlacementLon(Double placementLon) { |
| | | this.placementLon = placementLon; |
| | | } |
| | | |
| | | public Double getPlacementLat() { |
| | | return placementLat; |
| | | } |
| | | |
| | | public void setPlacementLat(Double placementLat) { |
| | | this.placementLat = placementLat; |
| | | } |
| | | |
| | | public String getPlacementAddress() { |
| | | return placementAddress; |
| | | } |
| | | |
| | | public void setPlacementAddress(String placementAddress) { |
| | | this.placementAddress = placementAddress; |
| | | } |
| | | |
| | | public Double getStartLon() { |
| | | return startLon; |
| | | } |
| | | |
| | | public void setStartLon(Double startLon) { |
| | | this.startLon = startLon; |
| | | } |
| | | |
| | | public Double getStartLat() { |
| | | return startLat; |
| | | } |
| | | |
| | | public void setStartLat(Double startLat) { |
| | | this.startLat = startLat; |
| | | } |
| | | |
| | | public String getStartAddress() { |
| | | return startAddress; |
| | | } |
| | | |
| | | public void setStartAddress(String startAddress) { |
| | | this.startAddress = startAddress; |
| | | } |
| | | |
| | | public Double getEndLon() { |
| | | return endLon; |
| | | } |
| | | |
| | | public void setEndLon(Double endLon) { |
| | | this.endLon = endLon; |
| | | } |
| | | |
| | | public Double getEndLat() { |
| | | return endLat; |
| | | } |
| | | |
| | | public void setEndLat(Double endLat) { |
| | | this.endLat = endLat; |
| | | } |
| | | |
| | | public String getEndAddress() { |
| | | return endAddress; |
| | | } |
| | | |
| | | public void setEndAddress(String endAddress) { |
| | | this.endAddress = endAddress; |
| | | } |
| | | |
| | | public Double getBoardingLon() { |
| | | return boardingLon; |
| | | } |
| | | |
| | | public void setBoardingLon(Double boardingLon) { |
| | | this.boardingLon = boardingLon; |
| | | } |
| | | |
| | | public Double getBoardingLat() { |
| | | return boardingLat; |
| | | } |
| | | |
| | | public void setBoardingLat(Double boardingLat) { |
| | | this.boardingLat = boardingLat; |
| | | } |
| | | |
| | | public String getBoardingAddress() { |
| | | return boardingAddress; |
| | | } |
| | | |
| | | public void setBoardingAddress(String boardingAddress) { |
| | | this.boardingAddress = boardingAddress; |
| | | } |
| | | |
| | | public Date getBoardingTime() { |
| | | return boardingTime; |
| | | } |
| | | |
| | | public void setBoardingTime(Date boardingTime) { |
| | | this.boardingTime = boardingTime; |
| | | } |
| | | |
| | | public Double getGetoffLon() { |
| | | return getoffLon; |
| | | } |
| | | |
| | | public void setGetoffLon(Double getoffLon) { |
| | | this.getoffLon = getoffLon; |
| | | } |
| | | |
| | | public Double getGetoffLat() { |
| | | return getoffLat; |
| | | } |
| | | |
| | | public void setGetoffLat(Double getoffLat) { |
| | | this.getoffLat = getoffLat; |
| | | } |
| | | |
| | | public String getGetoffAddress() { |
| | | return getoffAddress; |
| | | } |
| | | |
| | | public void setGetoffAddress(String getoffAddress) { |
| | | this.getoffAddress = getoffAddress; |
| | | } |
| | | |
| | | public Date getGetoffTime() { |
| | | return getoffTime; |
| | | } |
| | | |
| | | public void setGetoffTime(Date getoffTime) { |
| | | this.getoffTime = getoffTime; |
| | | } |
| | | |
| | | public Double getMileage() { |
| | | return mileage; |
| | | } |
| | | |
| | | public void setMileage(Double mileage) { |
| | | this.mileage = mileage; |
| | | } |
| | | |
| | | public Integer getPayManner() { |
| | | return payManner; |
| | | } |
| | | |
| | | public void setPayManner(Integer payManner) { |
| | | this.payManner = payManner; |
| | | } |
| | | |
| | | public Integer getPayType() { |
| | | return payType; |
| | | } |
| | | |
| | | public void setPayType(Integer payType) { |
| | | this.payType = payType; |
| | | } |
| | | |
| | | public Double getOrderMoney() { |
| | | return orderMoney; |
| | | } |
| | | |
| | | public void setOrderMoney(Double orderMoney) { |
| | | this.orderMoney = orderMoney; |
| | | } |
| | | |
| | | public Double getRedPacketMoney() { |
| | | return redPacketMoney; |
| | | } |
| | | |
| | | public void setRedPacketMoney(Double redPacketMoney) { |
| | | this.redPacketMoney = redPacketMoney; |
| | | } |
| | | |
| | | public Double getCouponMoney() { |
| | | return couponMoney; |
| | | } |
| | | |
| | | public void setCouponMoney(Double couponMoney) { |
| | | this.couponMoney = couponMoney; |
| | | } |
| | | |
| | | public Integer getRedPacketId() { |
| | | return redPacketId; |
| | | } |
| | | |
| | | public void setRedPacketId(Integer redPacketId) { |
| | | this.redPacketId = redPacketId; |
| | | } |
| | | |
| | | public Integer getCouponId() { |
| | | return couponId; |
| | | } |
| | | |
| | | public void setCouponId(Integer couponId) { |
| | | this.couponId = couponId; |
| | | } |
| | | |
| | | public Double getDiscount() { |
| | | return discount; |
| | | } |
| | | |
| | | public void setDiscount(Double discount) { |
| | | this.discount = discount; |
| | | } |
| | | |
| | | public Double getDiscountMoney() { |
| | | return discountMoney; |
| | | } |
| | | |
| | | public void setDiscountMoney(Double discountMoney) { |
| | | this.discountMoney = discountMoney; |
| | | } |
| | | |
| | | public Integer getActivityId() { |
| | | return activityId; |
| | | } |
| | | |
| | | public void setActivityId(Integer activityId) { |
| | | this.activityId = activityId; |
| | | } |
| | | |
| | | public Integer getCompanyId() { |
| | | return companyId; |
| | | } |
| | | |
| | | public void setCompanyId(Integer companyId) { |
| | | this.companyId = companyId; |
| | | } |
| | | |
| | | public Double getPayMoney() { |
| | | return payMoney; |
| | | } |
| | | |
| | | public void setPayMoney(Double payMoney) { |
| | | this.payMoney = payMoney; |
| | | } |
| | | |
| | | public String getPassengers() { |
| | | return passengers; |
| | | } |
| | | |
| | | public void setPassengers(String passengers) { |
| | | this.passengers = passengers; |
| | | } |
| | | |
| | | public String getPassengersPhone() { |
| | | return passengersPhone; |
| | | } |
| | | |
| | | public void setPassengersPhone(String passengersPhone) { |
| | | this.passengersPhone = passengersPhone; |
| | | } |
| | | |
| | | public Integer getPeopleNumber() { |
| | | return peopleNumber; |
| | | } |
| | | |
| | | public void setPeopleNumber(Integer peopleNumber) { |
| | | this.peopleNumber = peopleNumber; |
| | | } |
| | | |
| | | public String getSeatNumber() { |
| | | return seatNumber; |
| | | } |
| | | |
| | | public void setSeatNumber(String seatNumber) { |
| | | this.seatNumber = seatNumber; |
| | | } |
| | | |
| | | public Integer getSort() { |
| | | return sort; |
| | | } |
| | | |
| | | public void setSort(Integer sort) { |
| | | this.sort = sort; |
| | | } |
| | | |
| | | 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 Date getTravelTime() { |
| | | return travelTime; |
| | | } |
| | | |
| | | public void setTravelTime(Date travelTime) { |
| | | this.travelTime = travelTime; |
| | | } |
| | | |
| | | public Date getSnatchOrderTime() { |
| | | return snatchOrderTime; |
| | | } |
| | | |
| | | public void setSnatchOrderTime(Date snatchOrderTime) { |
| | | this.snatchOrderTime = snatchOrderTime; |
| | | } |
| | | |
| | | public Date getSetOutTime() { |
| | | return setOutTime; |
| | | } |
| | | |
| | | public void setSetOutTime(Date setOutTime) { |
| | | this.setOutTime = setOutTime; |
| | | } |
| | | |
| | | public Date getArriveTime() { |
| | | return arriveTime; |
| | | } |
| | | |
| | | public void setArriveTime(Date arriveTime) { |
| | | this.arriveTime = arriveTime; |
| | | } |
| | | |
| | | public Date getStartServiceTime() { |
| | | return startServiceTime; |
| | | } |
| | | |
| | | public void setStartServiceTime(Date startServiceTime) { |
| | | this.startServiceTime = startServiceTime; |
| | | } |
| | | |
| | | public Date getEndServiceTime() { |
| | | return endServiceTime; |
| | | } |
| | | |
| | | public void setEndServiceTime(Date endServiceTime) { |
| | | this.endServiceTime = endServiceTime; |
| | | } |
| | | |
| | | public Integer getTravelMode() { |
| | | return travelMode; |
| | | } |
| | | |
| | | public void setTravelMode(Integer travelMode) { |
| | | this.travelMode = travelMode; |
| | | } |
| | | |
| | | public Integer getOrderSource() { |
| | | return orderSource; |
| | | } |
| | | |
| | | public void setOrderSource(Integer orderSource) { |
| | | this.orderSource = orderSource; |
| | | } |
| | | |
| | | public Integer getInvoiceId() { |
| | | return invoiceId; |
| | | } |
| | | |
| | | public void setInvoiceId(Integer invoiceId) { |
| | | this.invoiceId = invoiceId; |
| | | } |
| | | |
| | | public String getTrackId() { |
| | | return trackId; |
| | | } |
| | | |
| | | public void setTrackId(String trackId) { |
| | | this.trackId = trackId; |
| | | } |
| | | |
| | | public Integer getIsDelete() { |
| | | return isDelete; |
| | | } |
| | | |
| | | public void setIsDelete(Integer isDelete) { |
| | | this.isDelete = isDelete; |
| | | } |
| | | |
| | | public String getTelX() { |
| | | return telX; |
| | | } |
| | | |
| | | public void setTelX(String telX) { |
| | | this.telX = telX; |
| | | } |
| | | |
| | | public String getBindId() { |
| | | return bindId; |
| | | } |
| | | |
| | | public void setBindId(String bindId) { |
| | | this.bindId = bindId; |
| | | } |
| | | |
| | | public Integer getIsReassign() { |
| | | return isReassign; |
| | | } |
| | | |
| | | public void setIsReassign(Integer isReassign) { |
| | | this.isReassign = isReassign; |
| | | } |
| | | |
| | | public Integer getReassignNotice() { |
| | | return reassignNotice; |
| | | } |
| | | |
| | | public void setReassignNotice(Integer reassignNotice) { |
| | | this.reassignNotice = reassignNotice; |
| | | } |
| | | |
| | | public Integer getOldState() { |
| | | return oldState; |
| | | } |
| | | |
| | | public void setOldState(Integer oldState) { |
| | | this.oldState = oldState; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "OrderCrossCity{" + |
| | | "id=" + id + |
| | | ", userId=" + userId + |
| | | ", serverCarModelId=" + serverCarModelId + |
| | | ", driverId=" + driverId + |
| | | ", lineId=" + lineId + |
| | | ", lineShiftDriverId=" + lineShiftDriverId + |
| | | ", carId=" + carId + |
| | | ", orderNum='" + orderNum + '\'' + |
| | | ", placementLon=" + placementLon + |
| | | ", placementLat=" + placementLat + |
| | | ", placementAddress='" + placementAddress + '\'' + |
| | | ", startLon=" + startLon + |
| | | ", startLat=" + startLat + |
| | | ", startAddress='" + startAddress + '\'' + |
| | | ", endLon=" + endLon + |
| | | ", endLat=" + endLat + |
| | | ", endAddress='" + endAddress + '\'' + |
| | | ", boardingLon=" + boardingLon + |
| | | ", boardingLat=" + boardingLat + |
| | | ", boardingAddress='" + boardingAddress + '\'' + |
| | | ", boardingTime=" + boardingTime + |
| | | ", getoffLon=" + getoffLon + |
| | | ", getoffLat=" + getoffLat + |
| | | ", getoffAddress='" + getoffAddress + '\'' + |
| | | ", getoffTime=" + getoffTime + |
| | | ", mileage=" + mileage + |
| | | ", payManner=" + payManner + |
| | | ", payType=" + payType + |
| | | ", orderMoney=" + orderMoney + |
| | | ", redPacketMoney=" + redPacketMoney + |
| | | ", couponMoney=" + couponMoney + |
| | | ", redPacketId=" + redPacketId + |
| | | ", couponId=" + couponId + |
| | | ", discount=" + discount + |
| | | ", discountMoney=" + discountMoney + |
| | | ", activityId=" + activityId + |
| | | ", companyId=" + companyId + |
| | | ", payMoney=" + payMoney + |
| | | ", passengers='" + passengers + '\'' + |
| | | ", passengersPhone='" + passengersPhone + '\'' + |
| | | ", peopleNumber=" + peopleNumber + |
| | | ", seatNumber='" + seatNumber + '\'' + |
| | | ", sort=" + sort + |
| | | ", state=" + state + |
| | | ", insertTime=" + insertTime + |
| | | ", travelTime=" + travelTime + |
| | | ", snatchOrderTime=" + snatchOrderTime + |
| | | ", setOutTime=" + setOutTime + |
| | | ", arriveTime=" + arriveTime + |
| | | ", startServiceTime=" + startServiceTime + |
| | | ", endServiceTime=" + endServiceTime + |
| | | ", travelMode=" + travelMode + |
| | | ", orderSource=" + orderSource + |
| | | ", isReassign=" + isReassign + |
| | | ", reassignNotice=" + reassignNotice + |
| | | ", invoiceId=" + invoiceId + |
| | | ", trackId='" + trackId + '\'' + |
| | | ", isDelete=" + isDelete + |
| | | ", oldState=" + oldState + |
| | | ", telX='" + telX + '\'' + |
| | | ", bindId='" + bindId + '\'' + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 线路站点 |
| | | */ |
| | | @TableName("t_site") |
| | | public class Site { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 站点名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 省名称 |
| | | */ |
| | | @TableField("province") |
| | | private String province; |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 市名称 |
| | | */ |
| | | @TableField("city") |
| | | private String city; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 区县名称 |
| | | */ |
| | | @TableField("district") |
| | | private String district; |
| | | /** |
| | | * 区县编号 |
| | | */ |
| | | @TableField("districtCode") |
| | | private String districtCode; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | /** |
| | | * 添加人id |
| | | */ |
| | | @TableField("insertUserId") |
| | | private Integer insertUserId; |
| | | |
| | | 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 getProvince() { |
| | | return province; |
| | | } |
| | | |
| | | public void setProvince(String province) { |
| | | this.province = province; |
| | | } |
| | | |
| | | public String getProvinceCode() { |
| | | return provinceCode; |
| | | } |
| | | |
| | | public void setProvinceCode(String provinceCode) { |
| | | this.provinceCode = provinceCode; |
| | | } |
| | | |
| | | public String getCity() { |
| | | return city; |
| | | } |
| | | |
| | | public void setCity(String city) { |
| | | this.city = city; |
| | | } |
| | | |
| | | public String getCityCode() { |
| | | return cityCode; |
| | | } |
| | | |
| | | public void setCityCode(String cityCode) { |
| | | this.cityCode = cityCode; |
| | | } |
| | | |
| | | public String getDistrict() { |
| | | return district; |
| | | } |
| | | |
| | | public void setDistrict(String district) { |
| | | this.district = district; |
| | | } |
| | | |
| | | public String getDistrictCode() { |
| | | return districtCode; |
| | | } |
| | | |
| | | public void setDistrictCode(String districtCode) { |
| | | this.districtCode = districtCode; |
| | | } |
| | | |
| | | 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 getInsertUserId() { |
| | | return insertUserId; |
| | | } |
| | | |
| | | public void setInsertUserId(Integer insertUserId) { |
| | | this.insertUserId = insertUserId; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Site{" + |
| | | "id=" + id + |
| | | ", name='" + name + '\'' + |
| | | ", province='" + province + '\'' + |
| | | ", provinceCode='" + provinceCode + '\'' + |
| | | ", city='" + city + '\'' + |
| | | ", cityCode='" + cityCode + '\'' + |
| | | ", district='" + district + '\'' + |
| | | ", districtCode='" + districtCode + '\'' + |
| | | ", state=" + state + |
| | | ", insertTime=" + insertTime + |
| | | ", insertUserId=" + insertUserId + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.server; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.crossCity.model.Line; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface ILineService extends IService<Line> { |
| | | |
| | | |
| | | /** |
| | | * 根据站点id获取线路数据 |
| | | * @param startId |
| | | * @param endId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryLines(Integer startId, Integer endId, Integer driverId) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据站点id获取线路数据 |
| | | * @param driverId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> scanCodeQueryLines(Integer driverId) throws Exception; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.server; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.crossCity.model.LineSite; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface ILineSiteService extends IService<LineSite> { |
| | | |
| | | |
| | | /** |
| | | * 根据线路获取排班数据 |
| | | * @param lineId |
| | | * @param day |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryDriver(Integer lineId, String day, Integer driverId) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 根据司机排班数据id获取数据(剩余座位号和总座位数) |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Map<String, Object> querySeat(Integer id) throws Exception; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.server; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.warpper.OrderCrossCityWarpper; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.OrderServerWarpper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface IOrderCrossCityService extends IService<OrderCrossCity> { |
| | | |
| | | |
| | | /** |
| | | * 计算支付金额 |
| | | * @param startLonLat |
| | | * @param endLonLat |
| | | * @param peopleNumber |
| | | * @param travelMode |
| | | * @param lineId |
| | | * @param serverCarModelId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil queryOrderMoney(String startLonLat, String endLonLat, Integer peopleNumber, Integer travelMode, Integer lineId, |
| | | Integer serverCarModelId, Integer totalSeat, String seatNumber) throws Exception; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取用户余额和可用优惠券数量 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Map<String, Object> queryBalance(Integer orderId, Integer uid) throws Exception; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取优惠券列表 |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryCoupon(Integer orderId, Integer uid, Integer pageNum, Integer size) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 订单完成支付订单操作 |
| | | * @param payType |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil payCrossCityOrder(Integer payType, Integer orderId, Integer couponId, Integer type)throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 支付完成后的订单处理 |
| | | * @param id 订单=id |
| | | * @param order_id 工行支付单号 |
| | | * @param type 1=微信,2=支付宝 |
| | | * @throws Exception |
| | | */ |
| | | void payOrderCrossCityCallback(Integer id, String order_id, Integer type) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 用户跨城下单操作 |
| | | * @param orderCrossCityWarpper |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil<BaseWarpper> orderCrossCity(OrderCrossCityWarpper orderCrossCityWarpper, Integer uid) throws Exception; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取订单数据 |
| | | * @param uid |
| | | * @param state |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<OrderCrossCity> queryOrder(Integer uid, Integer...state) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取订单详情 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | Map<String, Object> queryOrderInfo(Integer orderId) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取取消订单需要支付的金额 |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil<BaseWarpper> queryCancleAmount(Integer id) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 取消订单操作 |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil cancleOrderCrossCity(Integer id, Integer payType, Integer cancleId, Integer type) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 删除定时任务 |
| | | * @param orderId |
| | | * @throws Exception |
| | | */ |
| | | void deleteTask(Integer orderId) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 评论成功后获取红包金额 |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil<BaseWarpper> queryRedMoney(Integer orderId) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 分享成功后添加红包 |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil shareRedEnvelope(Integer orderId) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 取消订单支付后的处理 |
| | | * @param id 订单=id |
| | | * @param order_id 工行支付单号 |
| | | * @param type 1=微信,2=支付宝 |
| | | * @throws Exception |
| | | */ |
| | | void payCancelOrderCrossCity(Integer id, String order_id, Integer type) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取员工的订单列表 |
| | | * @param uid |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryMyOrderList(Integer uid, Integer pageNum, Integer size) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取历史消费记录 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryMyTravelRecord(@Param("uid") Integer uid); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取用户端发票页面中的订单列表数据 |
| | | * @param type 开票状态(1=未开票,2=已开票) |
| | | * @param startTime 订单开始时间 |
| | | * @param endTime 订单结束时间 |
| | | * @param startMoney 订单金额范围 |
| | | * @param endMoney |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryInvoiceOrder(Integer type, Date startTime, Date endTime, Double startMoney, |
| | | Double endMoney, Integer uid) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加取消 |
| | | * @param id |
| | | * @param reason |
| | | * @param remark |
| | | * @param uid |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil addCancle(Integer id, String reason, String remark, Integer uid) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取红包使用记录 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryRedEnvelope(Integer uid) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取服务中的订单数据 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | OrderServerWarpper queryOrderServer(Integer orderId, Integer uid) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 摆渡下单 |
| | | * @param serverCarModelIds |
| | | * @param travelTime |
| | | * @param placementLon |
| | | * @param placementLat |
| | | * @param startLon |
| | | * @param startLat |
| | | * @param startAddress |
| | | * @param endLon |
| | | * @param endLat |
| | | * @param endAddress |
| | | * @return |
| | | */ |
| | | ResultUtil<BaseWarpper> saveOrderFerry(String serverCarModelIds, Date travelTime, String placementLon, String placementLat, String startLon, |
| | | String startLat, String startAddress, String endLon, String endLat, String endAddress, |
| | | Integer crossCityOrderId, Integer place, Integer orderSource, Integer uid,String name ,String phone) throws Exception; |
| | | |
| | | |
| | | |
| | | void pushOrder(List<Map<String, Integer>> list) throws Exception; |
| | | |
| | | |
| | | |
| | | List<OrderCrossCity> queryListOrder(Integer driverId, Integer lineShiftId, List<Integer> state, String day) throws Exception; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.server; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.crossCity.model.Site; |
| | | import com.stylefeng.guns.modular.crossCity.warpper.SiteWarpper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface ISiteService extends IService<Site> { |
| | | |
| | | |
| | | /** |
| | | * 获取所有站点 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<SiteWarpper> querySite(Integer startSiteId) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 根据站点获取地点区域数据 |
| | | * @param siteId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryLocation(Integer siteId) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 判断坐标点是否在站点范围内 |
| | | * @param siteId |
| | | * @param code |
| | | * @param lonLat |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | boolean areaMonitoring(Integer siteId, String code, String lonLat) throws Exception; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.server.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.crossCity.dao.LineMapper; |
| | | import com.stylefeng.guns.modular.crossCity.model.Line; |
| | | import com.stylefeng.guns.modular.crossCity.server.ILineService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @Service |
| | | public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements ILineService { |
| | | |
| | | @Resource |
| | | private LineMapper lineMapper; |
| | | |
| | | |
| | | /** |
| | | * 根据站点id获取线路 |
| | | * @param startId |
| | | * @param endId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryLines(Integer startId, Integer endId, Integer driverId) throws Exception { |
| | | List<Map<String, Object>> list1 = lineMapper.queryLines(startId, 1); |
| | | List<Map<String, Object>> list2 = lineMapper.queryLines(endId, 2); |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for(Map<String, Object> map1 : list1){ |
| | | Integer id1 = Integer.valueOf(map1.get("id").toString()); |
| | | for(Map<String, Object> map2 : list2){ |
| | | Integer id2 = Integer.valueOf(map2.get("id").toString()); |
| | | if(id1.compareTo(id2) == 0){ |
| | | map1.put("startAddress", map1.get("siteName")); |
| | | map1.put("endAddress", map2.get("siteName")); |
| | | list.add(map1); |
| | | } |
| | | } |
| | | } |
| | | if(null != driverId){ |
| | | List<Map<String, Object>> lists = new ArrayList<>(); |
| | | List<Map<String, Object>> list3 = lineMapper.scanCodeQueryLines(driverId); |
| | | for(Map<String, Object> map1 : list){ |
| | | Integer id2 = Integer.valueOf(map1.get("id").toString()); |
| | | for(Map<String, Object> map : list3){ |
| | | Integer id1 = Integer.valueOf(map.get("id").toString()); |
| | | if(id1.compareTo(id2) == 0){ |
| | | lists.add(map1); |
| | | } |
| | | } |
| | | } |
| | | list = lists; |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 扫码获取司机的所有线路 |
| | | * @param driverId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> scanCodeQueryLines(Integer driverId) throws Exception { |
| | | return lineMapper.scanCodeQueryLines(driverId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.server.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.crossCity.dao.LineShiftDriverMapper; |
| | | import com.stylefeng.guns.modular.crossCity.dao.LineShiftMapper; |
| | | import com.stylefeng.guns.modular.crossCity.dao.LineSiteMapper; |
| | | import com.stylefeng.guns.modular.crossCity.model.LineShift; |
| | | import com.stylefeng.guns.modular.crossCity.model.LineShiftDriver; |
| | | import com.stylefeng.guns.modular.crossCity.model.LineSite; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.ILineSiteService; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.SystemException; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | |
| | | @Service |
| | | public class LineSiteServiceImpl extends ServiceImpl<LineSiteMapper, LineSite> implements ILineSiteService { |
| | | |
| | | @Resource |
| | | private LineSiteMapper lineSiteMapper; |
| | | |
| | | @Resource |
| | | private LineShiftDriverMapper lineShiftDriverMapper; |
| | | |
| | | @Resource |
| | | private LineShiftMapper lineShiftMapper; |
| | | |
| | | @Autowired |
| | | private IOrderTaxiService orderTaxiService; |
| | | |
| | | @Autowired |
| | | private IOrderPrivateCarService orderPrivateCarService; |
| | | |
| | | @Autowired |
| | | private IOrderCrossCityService orderCrossCityService; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据线路id获取排班数据 |
| | | * @param lineId |
| | | * @param day |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryDriver(Integer lineId, String day, Integer driverId) throws Exception { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar c = Calendar.getInstance(); |
| | | c.setTime(new Date()); |
| | | c.set(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH), 0, 0, 0); |
| | | c.set(Calendar.MILLISECOND, 0); |
| | | if(c.getTimeInMillis() > sdf.parse(day).getTime()){ |
| | | throw new SystemException("日期不能小于当天"); |
| | | } |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | List<LineShift> lineShifts = lineShiftMapper.queryByLineId(lineId); |
| | | List<Map<String, Object>> s = lineSiteMapper.queryDriver(lineId, sdf.parse(day), driverId); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(sdf.parse(day)); |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | List<Integer> integers = new ArrayList<>(); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | integers = JSON.parseArray(vehicle).toJavaList(Integer.class); |
| | | } |
| | | for(LineShift lineShift : lineShifts){ |
| | | boolean b = true; |
| | | String[] split = lineShift.getEndTime().split(":"); |
| | | calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); |
| | | calendar.set(Calendar.MINUTE, Integer.valueOf(split[1])); |
| | | if(calendar.getTimeInMillis() < System.currentTimeMillis()){//结束时间小于当前时间不显示 |
| | | continue; |
| | | } |
| | | |
| | | Map<String, Object> data = new HashMap<>(); |
| | | for(Map<String, Object> map : s){ |
| | | //先判断司机是否在限制接单范围内 |
| | | boolean bo = false; |
| | | for(Integer integer : integers){ |
| | | if(integer.compareTo(Integer.valueOf(map.get("driverId").toString())) == 0){ |
| | | bo = true; |
| | | break; |
| | | } |
| | | } |
| | | if(bo){ |
| | | continue; |
| | | } |
| | | |
| | | |
| | | int i = orderTaxiService.selectCount(new EntityWrapper<OrderTaxi>().eq("driverId", map.get("driverId")).in("state", Arrays.asList(2, 3, 4, 5, 11)).eq("DATE_FORMAT(travelTime, '%Y-%m-%d')", day)); |
| | | if(i > 0){ |
| | | continue; |
| | | } |
| | | i = orderPrivateCarService.selectCount(new EntityWrapper<OrderPrivateCar>().eq("driverId", map.get("driverId")).in("state", Arrays.asList(2, 3, 4, 5, 11)).eq("DATE_FORMAT(travelTime, '%Y-%m-%d')", day)); |
| | | if(i > 0){ |
| | | continue; |
| | | } |
| | | List<OrderCrossCity> driverId1 = orderCrossCityService.queryListOrder(Integer.valueOf(map.get("driverId").toString()), lineShift.getId(), Arrays.asList(5), day); |
| | | if(driverId1.size() > 0){ |
| | | continue; |
| | | } |
| | | if(Integer.valueOf(map.get("laveSeat").toString()) <= 0){ |
| | | continue; |
| | | } |
| | | if(lineShift.getId().intValue() == Integer.valueOf(map.get("id").toString()).intValue()){ |
| | | b = false; |
| | | String content = map.get("content").toString(); |
| | | JSONObject jsonObject = JSON.parseObject(content); |
| | | map.put("price", jsonObject.getString("num1")); |
| | | data = map; |
| | | list.add(data); |
| | | } |
| | | } |
| | | if(b){ |
| | | data.put("id", lineShift.getId()); |
| | | data.put("startTime", lineShift.getStartTime()); |
| | | list.add(data); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据司机排班数据id获取数据(剩余座位号和总座位数) |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public Map<String, Object> querySeat(Integer id) throws Exception { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | LineShiftDriver lineShiftDriver = lineShiftDriverMapper.selectById(id); |
| | | map.put("totalNumber", lineShiftDriver.getTotalSeat()); |
| | | map.put("number", lineShiftDriver.getLaveSeat()); |
| | | map.put("content", lineShiftDriver.getLaveSeatNumber()); |
| | | return map; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.server.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.crossCity.dao.LinePriceMapper; |
| | | import com.stylefeng.guns.modular.crossCity.dao.LineShiftDriverMapper; |
| | | import com.stylefeng.guns.modular.crossCity.dao.OrderCrossCityMapper; |
| | | import com.stylefeng.guns.modular.crossCity.model.Line; |
| | | import com.stylefeng.guns.modular.crossCity.model.LineShiftDriver; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.ILineService; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.crossCity.warpper.OrderCrossCityWarpper; |
| | | import com.stylefeng.guns.modular.specialTrain.dao.OrderPrivateCarMapper; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.specialTrain.server.impl.OrderPrivateCarServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.*; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.OrderServerWarpper; |
| | | import com.stylefeng.guns.modular.taxi.dao.OrderTaxiMapper; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.model.PaymentRecord; |
| | | import com.stylefeng.guns.modular.taxi.model.TransactionDetails; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; |
| | | import com.stylefeng.guns.modular.taxi.service.ITransactionDetailsService; |
| | | import com.stylefeng.guns.modular.taxi.service.impl.OrderTaxiServiceImpl; |
| | | import io.swagger.models.auth.In; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Isolation; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.LinkedMultiValueMap; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | |
| | | import static com.stylefeng.guns.modular.taxi.service.impl.OrderTaxiServiceImpl.orderIds; |
| | | |
| | | |
| | | @Service |
| | | @Transactional(isolation = Isolation.READ_UNCOMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
| | | public class OrderCrossCityServiceImpl extends ServiceImpl<OrderCrossCityMapper, OrderCrossCity> implements IOrderCrossCityService { |
| | | |
| | | @Resource |
| | | private OrderCrossCityMapper orderCrossCityMapper; |
| | | |
| | | @Resource |
| | | private LinePriceMapper linePriceMapper; |
| | | |
| | | @Resource |
| | | private UserActivityDiscount1Mapper userActivityDiscount1Mapper; |
| | | |
| | | @Resource |
| | | private SysIntegralMapper sysIntegralMapper; |
| | | |
| | | @Resource |
| | | private LineShiftDriverMapper lineShiftDriverMapper; |
| | | |
| | | @Resource |
| | | private OrderPrivateCarMapper orderPrivateCarMapper; |
| | | |
| | | @Resource |
| | | private OrderTaxiMapper orderTaxiMapper; |
| | | |
| | | @Resource |
| | | private RegionMapper regionMapper; |
| | | |
| | | @Resource |
| | | private SensitiveWordsMapper sensitiveWordsMapper; |
| | | |
| | | @Autowired |
| | | private GDMapElectricFenceUtil gdMapElectricFenceUtil; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | @Autowired |
| | | private IUserCouponRecordService userCouponRecordService; |
| | | |
| | | @Autowired |
| | | private IUserRedPacketRecordService userRedPacketRecordService; |
| | | |
| | | @Autowired |
| | | private IPaymentRecordService paymentRecordService; |
| | | // |
| | | // @Autowired |
| | | // private ICBCPayUtil icbcPayUtil; |
| | | |
| | | @Autowired |
| | | private ITransactionDetailsService transactionDetailsService; |
| | | |
| | | @Autowired |
| | | private IOrderPrivateCarService orderPrivateCarService; |
| | | |
| | | @Autowired |
| | | private ILineService lineService; |
| | | |
| | | @Autowired |
| | | private IIncomeService incomeService; |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | | |
| | | @Autowired |
| | | private ISystemNoticeService systemNoticeService; |
| | | |
| | | @Autowired |
| | | private DateUtil dateUtil; |
| | | |
| | | @Autowired |
| | | private GDMapGeocodingUtil gdMapGeocodingUtil; |
| | | |
| | | @Autowired |
| | | private ChinaMobileUtil chinaMobileUtil; |
| | | |
| | | @Autowired |
| | | private GDFalconUtil gdFalconUtil; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private ICancleOrderService cancleOrderService; |
| | | |
| | | @Autowired |
| | | private IOrderCancelService orderCancelService; |
| | | |
| | | @Autowired |
| | | private RestTemplate internalRestTemplate; |
| | | |
| | | @Autowired |
| | | private IUserActivityRedenvelopeService userActivityRedenvelopeService; |
| | | |
| | | @Autowired |
| | | private IOrderPositionService orderPositionService; |
| | | |
| | | @Autowired |
| | | private IOrderTaxiService orderTaxiService; |
| | | |
| | | @Autowired |
| | | private ICompanyCityService companyCityService; |
| | | |
| | | @Autowired |
| | | private IPushOrderService pushOrderService; |
| | | |
| | | @Autowired |
| | | private IOpenCityService openCityService; |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Autowired |
| | | private IOrderFrequentPassengersService orderFrequentPassengersService; |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath; |
| | | |
| | | public Map<String, Thread> threadMap = new HashMap<>(); |
| | | |
| | | //存储摆渡车无接单后推送标识,实现多个类型的摆渡车订单无人接单后只给前端推送一次 |
| | | public static Map<Integer, Boolean> pushEndMap = new HashMap<>(); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 计算支付金额 |
| | | * @param startLonLat |
| | | * @param endLonLat |
| | | * @param peopleNumber |
| | | * @param travelMode |
| | | * @param lineId |
| | | * @param serverCarModelId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil queryOrderMoney(String startLonLat, String endLonLat, Integer peopleNumber, Integer travelMode, Integer lineId, |
| | | Integer serverCarModelId, Integer totalSeat, String seatNumber) throws Exception { |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(startLonLat, endLonLat, 1);//调用高德计算距离 |
| | | if(null != distance){ |
| | | return this.getPrice(Double.valueOf(distance.get("distance")), peopleNumber, travelMode, lineId, serverCarModelId, totalSeat, seatNumber); |
| | | } |
| | | return ResultUtil.error("计算行程距离出错啦!"); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户余额和可用优惠券数量 |
| | | * @param orderId |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public Map<String, Object> queryBalance(Integer orderId, Integer uid) throws Exception { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | map.put("balance", userInfo.getBalance()); |
| | | OrderCrossCity orderCrossCity = this.selectById(orderId); |
| | | int i = userCouponRecordService.queryAvailable(uid, orderCrossCity.getCompanyId(), 1, 3, orderCrossCity.getOrderMoney()); |
| | | i = i + userCouponRecordService.queryAvailable(uid, orderCrossCity.getCompanyId(), 1, 0, orderCrossCity.getOrderMoney()); |
| | | map.put("coupon", i); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取支付页面的优惠券列表 |
| | | * @param orderId |
| | | * @param uid |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryCoupon(Integer orderId, Integer uid, Integer pageNum, Integer size) throws Exception { |
| | | OrderCrossCity orderCrossCity = this.selectById(orderId); |
| | | List<Map<String, Object>> list = userCouponRecordService.queryCoupon(uid, orderCrossCity.getCompanyId(), 1, 3, orderCrossCity.getOrderMoney(), pageNum, size); |
| | | List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon(uid, orderCrossCity.getCompanyId(), 1, 0, orderCrossCity.getOrderMoney(), pageNum, size); |
| | | list.addAll(list1); |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 订单支付 |
| | | * @param payType |
| | | * @param orderId |
| | | * @param couponId |
| | | * @param type |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil payCrossCityOrder(Integer payType, Integer orderId, Integer couponId, Integer type) throws Exception { |
| | | OrderCrossCity orderCrossCity = this.selectById(orderId); |
| | | if(orderCrossCity.getState() != 7){ |
| | | return ResultUtil.error("订单已完成支付,不允许重复支付"); |
| | | } |
| | | Integer uid = orderCrossCity.getUserId(); |
| | | Double orderMoney = orderCrossCity.getOrderMoney(); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | ResultUtil resultUtil = ResultUtil.success(); |
| | | orderCrossCity.setCouponMoney(0D);//初始化历史数据 |
| | | orderCrossCity.setCouponId(null); |
| | | |
| | | //计算优惠券 |
| | | UserCouponRecord userCouponRecord = null; |
| | | if(null != couponId){ |
| | | userCouponRecord = userCouponRecordService.selectById(couponId); |
| | | if(userCouponRecord.getCompanyId() != orderCrossCity.getCompanyId()){ |
| | | return ResultUtil.error("优惠券不能用于此订单"); |
| | | } |
| | | if(userCouponRecord.getState() == 2){ |
| | | return ResultUtil.error("优惠券已使用"); |
| | | } |
| | | if(userCouponRecord.getState() == 3){ |
| | | return ResultUtil.error("优惠券已过期"); |
| | | } |
| | | if(userCouponRecord.getCouponUseType() != 0 && userCouponRecord.getCouponUseType() != 3){ |
| | | return ResultUtil.error("优惠券不能用于此类型订单"); |
| | | } |
| | | if(userCouponRecord.getCouponType() == 2 && orderMoney.compareTo(userCouponRecord.getFullMoney()) < 0){ |
| | | return ResultUtil.error("优惠券不能用于此订单"); |
| | | } |
| | | orderMoney = orderMoney - userCouponRecord.getMoney(); |
| | | orderCrossCity.setCouponMoney(userCouponRecord.getMoney()); |
| | | orderCrossCity.setCouponId(couponId); |
| | | } |
| | | |
| | | //计算红包 |
| | | UserRedPacketRecord query = userRedPacketRecordService.query(uid, orderCrossCity.getCompanyId(), 1, 3, orderMoney); |
| | | if(null != query && orderMoney.compareTo(query.getMoney()) > 0){ |
| | | orderMoney = orderMoney - query.getMoney(); |
| | | orderCrossCity.setRedPacketMoney(query.getMoney()); |
| | | orderCrossCity.setRedPacketId(query.getId()); |
| | | } |
| | | |
| | | //计算折扣 |
| | | // UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(orderCrossCity.getCompanyId()); |
| | | // if(null != query2){ |
| | | // Double special = query2.getSpecial(); |
| | | // orderCrossCity.setDiscount(special); |
| | | // double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | // if(orderMoney.compareTo(v) > 0){ |
| | | // orderCrossCity.setDiscountMoney(orderMoney - v); |
| | | // orderCrossCity.setActivityId(query2.getId()); |
| | | // orderMoney = v; |
| | | // } |
| | | // } |
| | | |
| | | if(payType == 1){//微信支付 |
| | | String app = type == 1 ? "APP" : "JSAPI"; |
| | | resultUtil = payMoneyUtil.weixinpay("完成订单", "", orderId + "_3_" + UUIDUtil.getRandomCode(5), orderMoney.toString(), "/base/wxPayOrderTaxi", app, userInfo.getAppletsOpenId()); |
| | | paymentRecordService.saveData(1, orderCrossCity.getUserId(), 1, orderId, 3, 1, orderMoney, "", 1);//添加预支付数据 |
| | | } |
| | | if(payType == 2){//支付宝支付 |
| | | resultUtil = payMoneyUtil.alipay("完成订单", "完成订单", "", orderId + "_3_" + UUIDUtil.getRandomCode(5), orderMoney.toString(), "/base/aliPayOrderTaxi"); |
| | | paymentRecordService.saveData(1, orderCrossCity.getUserId(), 1, orderId, 3, 2, orderMoney, "", 1);//添加预支付数据 |
| | | } |
| | | |
| | | |
| | | // if(payType == 1){//微信支付 |
| | | // String value = redisUtil.getValue("appletOpenId"); |
| | | // String appletsOpenId = null; |
| | | // if(ToolUtil.isNotEmpty(value)){ |
| | | // JSONObject jsonObject = JSON.parseObject(value); |
| | | // appletsOpenId = jsonObject.getString(uid.toString()); |
| | | // }else{ |
| | | // appletsOpenId = userInfo.getAppletsOpenId(); |
| | | // } |
| | | // Map<String, String> map = icbcPayUtil.placeAnOrder(orderId + ",3", 9, 5, uid.toString(), "完成订单", orderMoney, callbackPath + "/base/wxPayOrderTaxi", "", type, appletsOpenId); |
| | | // if(map.get("code").equals("200")){ |
| | | // paymentRecordService.saveData(1, orderCrossCity.getUserId(), 1, orderId, 3, 1, orderMoney, map.get("order_id"), 1);//添加预支付数据 |
| | | // resultUtil = ResultUtil.success(map.get("data")); |
| | | // }else{ |
| | | // resultUtil = ResultUtil.error(map.get("msg"), ""); |
| | | // } |
| | | // } |
| | | // if(payType == 2){//支付宝支付 |
| | | // Map<String, String> map = icbcPayUtil.placeAnOrder(orderId + ",3", 10, 5, uid.toString(), "完成订单", orderMoney, callbackPath + "/base/aliPayOrderTaxi", "", type, null); |
| | | // if(map.get("code").equals("200")){ |
| | | // paymentRecordService.saveData(1, orderCrossCity.getUserId(), 1, orderId, 3, 2, orderMoney, map.get("order_id"), 1);//添加预支付数据 |
| | | // resultUtil = ResultUtil.success(map.get("data")); |
| | | // }else{ |
| | | // resultUtil = ResultUtil.error(map.get("msg"), ""); |
| | | // } |
| | | // } |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){ |
| | | return ResultUtil.error("余额不足,无法完成支付"); |
| | | } |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | |
| | | SysIntegral query1 = sysIntegralMapper.query(orderCrossCity.getCompanyId()); |
| | | userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * (null == query1 ? 0 : query1.getIntegral())));//积分 |
| | | |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "完成订单", orderMoney, 2, 1, 1, 3, orderId); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | orderCrossCity.setState(2);//跨城支付完成后才开始服务 |
| | | orderCrossCity.setPayType(3); |
| | | orderCrossCity.setPayMoney(orderMoney); |
| | | |
| | | //处理优惠券和红包 |
| | | if(null != userCouponRecord){ |
| | | userCouponRecord.setState(2); |
| | | userCouponRecord.setEndTime(new Date()); |
| | | userCouponRecordService.updateById(userCouponRecord); |
| | | } |
| | | if(null != query){ |
| | | query.setState(2); |
| | | query.setEndTime(new Date()); |
| | | userRedPacketRecordService.updateById(query); |
| | | } |
| | | |
| | | //添加已收入明细 |
| | | Line line = lineService.selectById(orderCrossCity.getLineId()); |
| | | Double speMoney = Double.valueOf(line.getRakeRate()); |
| | | BigDecimal d = new BigDecimal(orderCrossCity.getOrderMoney()).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))).setScale(2, BigDecimal.ROUND_HALF_EVEN);//企业收入 |
| | | BigDecimal c = new BigDecimal(orderCrossCity.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);//司机收入 |
| | | incomeService.saveData(1, orderCrossCity.getCompanyId(), 2, orderCrossCity.getId(), 3, d.doubleValue()); |
| | | incomeService.saveData(2, orderCrossCity.getDriverId(), 2, orderCrossCity.getId(), 3, c.doubleValue()); |
| | | Driver driver = driverService.selectById(orderCrossCity.getDriverId()); |
| | | driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | |
| | | // TODO: 2020/5/24 这里需要给司机和用户推送订单状态 |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderCrossCity.getUserId(), orderCrossCity.getId(), 3, orderCrossCity.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderCrossCity.getDriverId(), orderCrossCity.getId(), 3, orderCrossCity.getState(), 0); |
| | | pushUtil.pushDriverPosition(orderCrossCity.getId(), 3); |
| | | } |
| | | }).start(); |
| | | |
| | | systemNoticeService.addSystemNotice(1, "您已使用余额成功完成出行订单支付,谢谢使用!", uid, 1); |
| | | } |
| | | |
| | | this.updateAllColumnById(orderCrossCity); |
| | | return resultUtil; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付成功后的回调操作 |
| | | * @param id 订单=id |
| | | * @param order_id 工行支付单号 |
| | | * @param type 1=微信,2=支付宝 |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void payOrderCrossCityCallback(Integer id, String order_id, Integer type) throws Exception { |
| | | OrderCrossCity orderCrossCity = this.selectById(id); |
| | | PaymentRecord query = paymentRecordService.query(1, orderCrossCity.getUserId(), 1, Integer.valueOf(id), 3, type, 1); |
| | | if(null != query){ |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderCrossCity.getUserId(), "完成订单", query.getAmount(), 2, 1, 1, 3, query.getOrderId()); |
| | | orderCrossCity.setState(2);//先支付再服务 |
| | | orderCrossCity.setPayType(type); |
| | | orderCrossCity.setPayMoney(query.getAmount()); |
| | | this.updateById(orderCrossCity); |
| | | |
| | | UserInfo userInfo = userInfoService.selectById(orderCrossCity.getUserId()); |
| | | SysIntegral query1 = sysIntegralMapper.query(orderCrossCity.getCompanyId()); |
| | | userInfo.setIntegral(userInfo.getIntegral() + (query.getAmount().intValue() |
| | | * (null == query1 ? 0 : query1.getIntegral())));//积分 |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | //处理优惠券和红包 |
| | | if(null != orderCrossCity.getCouponId()){ |
| | | UserCouponRecord userCouponRecord = userCouponRecordService.selectById(orderCrossCity.getCouponId()); |
| | | userCouponRecord.setState(2); |
| | | userCouponRecord.setEndTime(new Date()); |
| | | userCouponRecordService.updateById(userCouponRecord); |
| | | } |
| | | if(null != orderCrossCity.getRedPacketId()){ |
| | | UserRedPacketRecord userRedPacketRecord = userRedPacketRecordService.selectById(orderCrossCity.getRedPacketId()); |
| | | userRedPacketRecord.setState(2); |
| | | userRedPacketRecord.setEndTime(new Date()); |
| | | userRedPacketRecordService.updateById(userRedPacketRecord); |
| | | } |
| | | |
| | | |
| | | query.setState(2); |
| | | query.setCode(order_id); |
| | | paymentRecordService.updateById(query); |
| | | |
| | | //添加已收入明细 |
| | | Line line = lineService.selectById(orderCrossCity.getLineId()); |
| | | Double speMoney = Double.valueOf(line.getRakeRate()); |
| | | BigDecimal d = new BigDecimal(orderCrossCity.getOrderMoney()).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))).setScale(2, BigDecimal.ROUND_HALF_EVEN);//企业收入 |
| | | BigDecimal c = new BigDecimal(orderCrossCity.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);//司机收入 |
| | | incomeService.saveData(1, orderCrossCity.getCompanyId(), 2, orderCrossCity.getId(), 3, d.doubleValue()); |
| | | incomeService.saveData(2, orderCrossCity.getDriverId(), 2, orderCrossCity.getId(), 3, c.doubleValue()); |
| | | Driver driver = driverService.selectById(orderCrossCity.getDriverId()); |
| | | driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | |
| | | // TODO: 2020/5/24 这里需要给司机和用户推送订单状态 |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderCrossCity.getUserId(), orderCrossCity.getId(), 3, orderCrossCity.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderCrossCity.getDriverId(), orderCrossCity.getId(), 3, orderCrossCity.getState(), 0); |
| | | pushUtil.pushDriverPosition(orderCrossCity.getId(), 3); |
| | | } |
| | | }).start(); |
| | | |
| | | |
| | | systemNoticeService.addSystemNotice(1, "您已使用" + (type == 1 ? "微信" : "支付宝") + "成功完成出行订单支付,谢谢使用!", orderCrossCity.getUserId(), 1); |
| | | }else{ |
| | | System.err.println("预支付数据异常(orderId = " + id + ")"); |
| | | } |
| | | } |
| | | @Resource |
| | | private DriverWorkMapper driverWorkMapper; |
| | | |
| | | /** |
| | | * 跨城下单操作 |
| | | * @param orderCrossCityWarpper |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public synchronized ResultUtil<BaseWarpper> orderCrossCity(OrderCrossCityWarpper orderCrossCityWarpper, Integer uid) throws Exception { |
| | | /** |
| | | * 1.下了即时单就不能下预约单和即时单 |
| | | * 2.下了预约单和再下一张即时单不能再下预约单 |
| | | */ |
| | | List<OrderPrivateCar> orderPrivateCars = orderPrivateCarMapper.queryByState(uid, 1, 1, 1, 2, 3, 4, 5, 6, 7, 11); |
| | | if(orderPrivateCars.size() > 0){ |
| | | return ResultUtil.error("有未完成的订单"); |
| | | } |
| | | List<OrderTaxi> list = orderTaxiMapper.queryByState_(uid, 1, 1, 1, 2, 3, 4, 5, 6, 11); |
| | | if(list.size() > 0){ |
| | | return ResultUtil.error("有未完成的订单"); |
| | | } |
| | | List<OrderCrossCity> orderCrossCities1 = orderCrossCityMapper.queryByState(uid, 1, 2, 3, 4, 5, 7, 11); |
| | | if(orderCrossCities1.size() > 0){ |
| | | return ResultUtil.error("有未完成的订单"); |
| | | } |
| | | |
| | | List<OrderCrossCity> orderCrossCities2 = orderCrossCityMapper.queryOrders(orderCrossCityWarpper.getDriverId(), orderCrossCityWarpper.getLineShiftDriverId(), Arrays.asList(5)); |
| | | if(orderCrossCities2.size() > 0){ |
| | | return ResultUtil.error("司机正在服务中"); |
| | | } |
| | | |
| | | /** |
| | | * 先判断司机座位数是否符合出行人数 |
| | | */ |
| | | LineShiftDriver lineShiftDriver = lineShiftDriverMapper.selectById(orderCrossCityWarpper.getLineShiftDriverId()); |
| | | if(orderCrossCityWarpper.getTravelMode() == 1){//拼车判断座位数 |
| | | if(lineShiftDriver.getLaveSeat() < orderCrossCityWarpper.getPeopleNumber()){ |
| | | return ResultUtil.error("司机剩余座位数小于出行人数"); |
| | | } |
| | | }else{ |
| | | if(lineShiftDriver.getLaveSeat() != lineShiftDriver.getTotalSeat()){ |
| | | return ResultUtil.error("司机车辆上已经有人占座了,不能下包车订单"); |
| | | } |
| | | if(lineShiftDriver.getLaveSeat() == 0){ |
| | | return ResultUtil.error("司机车辆没有剩余空位了"); |
| | | } |
| | | } |
| | | Driver driver = driverService.selectById(orderCrossCityWarpper.getDriverId()); |
| | | if(driver.getState() == 1){ |
| | | return ResultUtil.error("司机处于离线状态"); |
| | | } |
| | | DriverWork driverWork = driverWorkMapper.queryNewWork(driver.getId(), null, 1); |
| | | if (!driverWork.getType().contains("3")){ |
| | | return ResultUtil.error("司机暂未开通跨城服务"); |
| | | } |
| | | |
| | | |
| | | |
| | | OrderCrossCity orderCrossCity = new OrderCrossCity(); |
| | | orderCrossCity.setUserId(uid); |
| | | orderCrossCity.setServerCarModelId(orderCrossCityWarpper.getServerCarModelId()); |
| | | orderCrossCity.setDriverId(orderCrossCityWarpper.getDriverId()); |
| | | orderCrossCity.setLineId(orderCrossCityWarpper.getLineId()); |
| | | orderCrossCity.setLineShiftDriverId(orderCrossCityWarpper.getLineShiftDriverId()); |
| | | orderCrossCity.setCarId(orderCrossCityWarpper.getCarId()); |
| | | orderCrossCity.setOrderNum(this.getOrderNum(orderCrossCityWarpper.getDriverId(), orderCrossCityWarpper.getLineShiftDriverId())); |
| | | orderCrossCity.setPlacementLon(orderCrossCityWarpper.getPlacementLon()); |
| | | orderCrossCity.setPlacementLat(orderCrossCityWarpper.getPlacementLat()); |
| | | String placementAddress = orderCrossCityWarpper.getPlacementAddress(); |
| | | placementAddress = placementAddress.replaceAll("& #40;", "("); |
| | | placementAddress = placementAddress.replaceAll("& #41;", ")"); |
| | | orderCrossCity.setPlacementAddress(placementAddress); |
| | | orderCrossCity.setStartLon(orderCrossCityWarpper.getStartLon()); |
| | | orderCrossCity.setStartLat(orderCrossCityWarpper.getStartLat()); |
| | | String startAddress = orderCrossCityWarpper.getStartAddress(); |
| | | startAddress = startAddress.replaceAll("& #40;", "("); |
| | | startAddress = startAddress.replaceAll("& #41;", ")"); |
| | | orderCrossCity.setStartAddress(startAddress); |
| | | orderCrossCity.setEndLon(orderCrossCityWarpper.getEndLon()); |
| | | orderCrossCity.setEndLat(orderCrossCityWarpper.getEndLat()); |
| | | String endAddress = orderCrossCityWarpper.getEndAddress(); |
| | | endAddress = endAddress.replaceAll("& #40;", "("); |
| | | endAddress = endAddress.replaceAll("& #41;", ")"); |
| | | orderCrossCity.setEndAddress(endAddress); |
| | | orderCrossCity.setMileage(0D); |
| | | ResultUtil<Map<String, Object>> price = this.getPrice(orderCrossCityWarpper.getDistance(), orderCrossCityWarpper.getPeopleNumber(), orderCrossCityWarpper.getTravelMode(), orderCrossCityWarpper.getLineId(), |
| | | orderCrossCityWarpper.getServerCarModelId(), orderCrossCityWarpper.getTotalSeat(), orderCrossCityWarpper.getSeatNumber()); |
| | | Double money = Double.valueOf(price.getData().get("price").toString()); |
| | | orderCrossCity.setOrderMoney(money); |
| | | Integer companyId = driver.getCompanyId(); |
| | | orderCrossCity.setCompanyId(companyId); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | orderCrossCity.setPassengers(userInfo.getNickName()); |
| | | orderCrossCity.setPassengersPhone(userInfo.getPhone()); |
| | | orderCrossCity.setPeopleNumber(orderCrossCityWarpper.getPeopleNumber()); |
| | | orderCrossCity.setSeatNumber(orderCrossCityWarpper.getSeatNumber()); |
| | | List<OrderCrossCity> orderCrossCities = this.selectList(new EntityWrapper<OrderCrossCity>().eq("orderNum", orderCrossCity.getOrderNum()).eq("isDelete", 1)); |
| | | orderCrossCity.setSort(orderCrossCities.size() + 1); |
| | | orderCrossCity.setState(7);//待支付 |
| | | orderCrossCity.setInsertTime(new Date()); |
| | | orderCrossCity.setTravelTime(orderCrossCityWarpper.getTravelTime()); |
| | | orderCrossCity.setSnatchOrderTime(new Date()); |
| | | orderCrossCity.setTravelMode(orderCrossCityWarpper.getTravelMode()); |
| | | orderCrossCity.setOrderSource(orderCrossCityWarpper.getOrderSource()); |
| | | orderCrossCity.setIsDelete(1); |
| | | orderCrossCity.setRemark(orderCrossCityWarpper.getRemark()); |
| | | orderCrossCity.setIsReassign(1); |
| | | //调用高德创建轨迹 |
| | | String s = gdFalconUtil.selectTerminal(driver.getPhone()); |
| | | String track = gdFalconUtil.createTrack(s); |
| | | orderCrossCity.setTrackId(track); |
| | | if(orderCrossCity.getTravelMode() == 2){//包车 |
| | | orderCrossCity.setSeatNumber(lineShiftDriver.getLaveSeatNumber()); |
| | | orderCrossCity.setPeopleNumber(lineShiftDriver.getLaveSeat()); |
| | | } |
| | | |
| | | //调用移动的小号接口 |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(orderCrossCity.getStartLon().toString(), orderCrossCity.getStartLat().toString()); |
| | | Region region = regionMapper.query(geocode.get("districtCode")); |
| | | // Map<String, String> map = chinaMobileUtil.midAxbBindSend(orderCrossCity.getPassengersPhone(), driver.getPhone(), Integer.valueOf(region.getCitycode().substring(1))); |
| | | // if(String.valueOf(map.get("code")).equals("200")){ |
| | | // orderCrossCity.setTelX(map.get("telX")); |
| | | // orderCrossCity.setBindId(map.get("bindId")); |
| | | // } |
| | | this.insert(orderCrossCity); |
| | | |
| | | if(ToolUtil.isNotEmpty(orderCrossCityWarpper.getFrequentPassengersId())){ |
| | | List<Integer> list1 = JSON.parseArray(orderCrossCityWarpper.getFrequentPassengersId(), Integer.class); |
| | | for (Integer integer : list1) { |
| | | OrderFrequentPassengers orderFrequentPassengers = new OrderFrequentPassengers(); |
| | | orderFrequentPassengers.setOrderId(orderCrossCity.getId()); |
| | | orderFrequentPassengers.setOrderType(3); |
| | | orderFrequentPassengers.setFrequentPassengersId(integer); |
| | | orderFrequentPassengersService.insert(orderFrequentPassengers); |
| | | } |
| | | } |
| | | |
| | | if(orderCrossCity.getTravelTime().getTime() < System.currentTimeMillis() + 600000){ |
| | | driver.setState(3); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | //修改预约班次的数据 |
| | | if(orderCrossCity.getTravelMode() == 2){//包车 |
| | | lineShiftDriver.setLaveSeat(0); |
| | | lineShiftDriver.setLaveSeatNumber(""); |
| | | }else{//拼车 |
| | | lineShiftDriver.setLaveSeat((lineShiftDriver.getLaveSeat() - orderCrossCity.getPeopleNumber()) < 0 ? 0 : lineShiftDriver.getLaveSeat() - orderCrossCity.getPeopleNumber()); |
| | | String[] split = orderCrossCity.getSeatNumber().split(","); |
| | | String[] split1 = lineShiftDriver.getLaveSeatNumber().split(","); |
| | | String seatNumber = ""; |
| | | //先判断选中座位号和剩余座位号是否匹配 |
| | | for(String spl : split){ |
| | | boolean b = true; |
| | | for(String sp : split1){ |
| | | if(ToolUtil.isNotEmpty(spl) && ToolUtil.isNotEmpty(sp) && sp.equals(spl)){ |
| | | b = false; |
| | | break; |
| | | } |
| | | } |
| | | if(b){ |
| | | throw new SystemException("您选中的" + spl + "号座位已被占用,请选择其他座位!"); |
| | | } |
| | | } |
| | | for(String sp : split1){ |
| | | boolean b = true; |
| | | for(String spl : split){ |
| | | if(ToolUtil.isNotEmpty(spl) && ToolUtil.isNotEmpty(sp) && sp.equals(spl)){ |
| | | b = false; |
| | | break; |
| | | } |
| | | } |
| | | if(b && ToolUtil.isNotEmpty(sp)){ |
| | | seatNumber += (sp + ","); |
| | | } |
| | | } |
| | | lineShiftDriver.setLaveSeatNumber((ToolUtil.isNotEmpty(seatNumber) && seatNumber.length() > 0) ? |
| | | seatNumber.substring(0, seatNumber.length() - 1) : ""); |
| | | } |
| | | lineShiftDriverMapper.updateById(lineShiftDriver); |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, "您的跨城订单已下单成功!", orderCrossCity.getUserId(), 1); |
| | | |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setId(orderCrossCity.getId()); |
| | | |
| | | //创建定时任务,取消订单30分钟 |
| | | TimerTask timerTask = new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | OrderCrossCity orderCrossCity1 = orderCrossCityMapper.selectById(orderCrossCity.getId()); |
| | | if(orderCrossCity1.getState() == 7 && orderCrossCity1.getPayMoney() == null){ |
| | | orderCrossCity1.setState(10); |
| | | orderCrossCityMapper.updateById(orderCrossCity1); |
| | | |
| | | OrderCancel orderCancel = new OrderCancel(); |
| | | orderCancel.setOrderId(orderCrossCity.getId()); |
| | | orderCancel.setOrderType(3); |
| | | orderCancel.setReason("用户未及时付款,系统自动取消订单"); |
| | | orderCancel.setRemark("用户未及时付款,系统自动取消订单"); |
| | | orderCancel.setState(2); |
| | | orderCancel.setInsertTime(new Date()); |
| | | orderCancel.setUserType(2); |
| | | orderCancelService.insert(orderCancel); |
| | | |
| | | //修改司机座位 |
| | | LineShiftDriver lineShiftDriver = lineShiftDriverMapper.selectById(orderCrossCity.getLineShiftDriverId()); |
| | | lineShiftDriver.setLaveSeat(lineShiftDriver.getLaveSeat() + orderCrossCity.getPeopleNumber()); |
| | | lineShiftDriver.setLaveSeatNumber(lineShiftDriver.getLaveSeatNumber() + (orderCrossCity.getTravelMode() == 1 ? "," : "") + orderCrossCity.getSeatNumber()); |
| | | lineShiftDriverMapper.updateById(lineShiftDriver); |
| | | |
| | | //修改司机为空闲 |
| | | List<OrderCrossCity> orderCrossCities = orderCrossCityMapper.queryByDriverId(orderCrossCity.getDriverId(), 2, 3, 4, 5, 11); |
| | | if(orderCrossCities.size() == 0){ |
| | | Driver driver = driverService.selectById(orderCrossCity.getDriverId()); |
| | | driver.setState(2); |
| | | driverService.updateById(driver); |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | Timer timer = new Timer(); |
| | | timer.schedule(timerTask, 30 * 60 * 1000); |
| | | |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取订单 |
| | | * @param uid |
| | | * @param state |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<OrderCrossCity> queryOrder(Integer uid, Integer... state) throws Exception { |
| | | return orderCrossCityMapper.queryByState(uid, state); |
| | | } |
| | | |
| | | /** |
| | | * 获取订单详情 |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public Map<String, Object> queryOrderInfo(Integer orderId) throws Exception { |
| | | Map<String, Object> map = orderCrossCityMapper.queryOrderInfo(orderId); |
| | | if(null != map.get("reassignNotice") && Integer.valueOf(String.valueOf(map.get("reassignNotice"))) == 2){//改派完成,重新获取了新的司机数据,开始修改数据防止继续调用 |
| | | OrderCrossCity orderCrossCity = this.selectById(orderId); |
| | | orderCrossCity.setReassignNotice(0); |
| | | this.updateById(orderCrossCity); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("state"))) == 11){ |
| | | map.put("state", map.get("oldState")); |
| | | } |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(map.get("startLon").toString(), map.get("startLat").toString()); |
| | | map.put("startCity", geocode.get("city")); |
| | | geocode = gdMapGeocodingUtil.geocode(map.get("endLon").toString(), map.get("endLat").toString()); |
| | | map.put("endCity", geocode.get("city")); |
| | | |
| | | String driverId = redisUtil.getValue("DEVICE_" + map.get("driverId")); |
| | | map.put("device", ToolUtil.isNotEmpty(driverId) ? 2 : 1); |
| | | map.put("orderType", 3); |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 获取取消订单的支付费用 |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil<BaseWarpper> queryCancleAmount(Integer id) throws Exception { |
| | | OrderCrossCity orderCrossCity = this.selectById(id); |
| | | if(null == orderCrossCity){ |
| | | return ResultUtil.error("获取数据失败,订单信息有误"); |
| | | } |
| | | double amount = 0; |
| | | CancleOrder query = cancleOrderService.query(1, 3, orderCrossCity.getCompanyId()); |
| | | if(null != orderCrossCity.getDriverId() && |
| | | (orderCrossCity.getSnatchOrderTime().getTime() + query.getMinuteNum() * 60 * 1000) < new Date().getTime()){//收费的情况 |
| | | if(null != query){ |
| | | amount += query.getMoney(); |
| | | } |
| | | } |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setAmount(amount); |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 取消订单操作 |
| | | * @param id |
| | | * @param payType |
| | | * @param cancleId |
| | | * @param type |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil cancleOrderCrossCity(Integer id, Integer payType, Integer cancleId, Integer type) throws Exception { |
| | | OrderCrossCity orderCrossCity = this.selectById(id); |
| | | Integer uid = orderCrossCity.getUserId(); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | ResultUtil resultUtil = ResultUtil.success(); |
| | | |
| | | if(null == orderCrossCity){ |
| | | return ResultUtil.error("取消订单失败,订单信息有误"); |
| | | } |
| | | if(orderCrossCity.getState() != 12){ |
| | | return ResultUtil.error("取消订单失败,不合法的操作"); |
| | | } |
| | | OrderCancel orderCancel = null; |
| | | if(null == cancleId){ |
| | | orderCancel = orderCancelService.query(id, 3, null, null, 1); |
| | | }else{ |
| | | orderCancel = orderCancelService.selectById(cancleId); |
| | | } |
| | | |
| | | CancleOrder query = cancleOrderService.query(1, 3, orderCrossCity.getCompanyId()); |
| | | if(null != query){ |
| | | if(payType == 1){//微信支付 |
| | | String value = redisUtil.getValue("appletOpenId"); |
| | | String appletsOpenId = null; |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | JSONObject jsonObject = JSON.parseObject(value); |
| | | appletsOpenId = jsonObject.getString(uid.toString()); |
| | | }else{ |
| | | appletsOpenId = userInfo.getAppletsOpenId(); |
| | | } |
| | | orderCancel.setPayType(1); |
| | | orderCancelService.updateById(orderCancel); |
| | | |
| | | String app = type == 1 ? "APP" : "JSAPI"; |
| | | resultUtil = payMoneyUtil.weixinpay("订单取消", "", id + "_3_" + UUIDUtil.getRandomCode(5), query.getMoney().toString(), "/base/wxCancelOrderTaxi", app, userInfo.getAppletsOpenId()); |
| | | paymentRecordService.saveData(1, orderCrossCity.getUserId(), 1, id, 3, 1, query.getMoney(), "", 1);//添加预支付数据 |
| | | |
| | | // Map<String, String> map = icbcPayUtil.placeAnOrder(id + ",3", 9, 5, uid.toString(), "订单取消", query.getMoney(), callbackPath + "/base/wxCancelOrderTaxi", "", type, appletsOpenId); |
| | | // if(map.get("code").equals("200")){ |
| | | // paymentRecordService.saveData(1, orderCrossCity.getUserId(), 1, id, 3, 1, query.getMoney(), map.get("order_id"), 1);//添加预支付数据 |
| | | // resultUtil = ResultUtil.success(map.get("data")); |
| | | // }else{ |
| | | // resultUtil = ResultUtil.error(map.get("msg"), ""); |
| | | // } |
| | | } |
| | | if(payType == 2){//支付宝支付 |
| | | orderCancel.setPayType(2); |
| | | orderCancelService.updateById(orderCancel); |
| | | |
| | | resultUtil = payMoneyUtil.alipay("订单取消", "订单取消", "", id + "_3_" + UUIDUtil.getRandomCode(5), query.getMoney().toString(), "/base/aliCancelOrderTaxi"); |
| | | paymentRecordService.saveData(1, orderCrossCity.getUserId(), 1, id, 3, 2, query.getMoney(), "", 1);//添加预支付数据 |
| | | |
| | | // Map<String, String> map = icbcPayUtil.placeAnOrder(id + ",3", 10, 5, uid.toString(), "订单取消", query.getMoney(), callbackPath + "/base/aliCancelOrderTaxi", "", type, null); |
| | | // if(map.get("code").equals("200")){ |
| | | // paymentRecordService.saveData(1, orderCrossCity.getUserId(), 1, id, 3, 2, query.getMoney(), map.get("order_id"), 1);//添加预支付数据 |
| | | // resultUtil = ResultUtil.success(map.get("data")); |
| | | // }else{ |
| | | // resultUtil = ResultUtil.error(map.get("msg"), ""); |
| | | // } |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()){ |
| | | return ResultUtil.error("余额不足,无法完成支付"); |
| | | } |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(query.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "取消订单", query.getMoney(), 2, 1, 1, 3, id); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | //解除小号绑定 |
| | | if(orderCrossCity.getBindId() != null){ |
| | | chinaMobileUtil.midAxbUnBindSend(orderCrossCity.getBindId()); |
| | | } |
| | | |
| | | orderCrossCity.setState(10); |
| | | orderCrossCity.setTelX(""); |
| | | orderCrossCity.setBindId(""); |
| | | this.updateById(orderCrossCity); |
| | | |
| | | orderCancel.setState(2); |
| | | orderCancel.setPayType(3); |
| | | orderCancelService.updateById(orderCancel); |
| | | |
| | | //添加已收入明细 |
| | | incomeService.saveData(1, orderCrossCity.getCompanyId(), 3, orderCrossCity.getId(), 3, query.getMoney()); |
| | | |
| | | this.deleteTask(id);//删除定时任务 |
| | | |
| | | // new Thread(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // pushUtil.pushOrderState(2, orderCrossCity.getDriverId(), orderCrossCity.getId(), 3, orderCrossCity.getState(), 0); |
| | | // } |
| | | // }).start(); |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, "您已使用余额成功支付取消订单费用,谢谢使用!", orderCrossCity.getUserId(), 1); |
| | | } |
| | | } |
| | | return resultUtil; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 计算价格 |
| | | * @param distance |
| | | * @param peopleNumber |
| | | * @param travelMode |
| | | * @param lineId |
| | | * @param serverCarModelId |
| | | * @param totalSeat |
| | | * @param seatNumber |
| | | * @return |
| | | */ |
| | | public ResultUtil<Map<String, Object>> getPrice(Double distance, Integer peopleNumber, Integer travelMode, Integer lineId, Integer serverCarModelId, Integer totalSeat, String seatNumber){ |
| | | if(0 >= peopleNumber && peopleNumber > 6){ |
| | | return ResultUtil.error("请输入正确的乘车人数"); |
| | | } |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | double distance1 = distance.doubleValue() / 1000;//公里 |
| | | map.put("distance", distance); |
| | | |
| | | /** |
| | | * 1.固定价格的包车是整车价格 |
| | | * 2.五座车和七座车的优惠系数是中间特殊位置的优惠折扣 |
| | | * 3.包车的情况不享受中间特殊位置的优惠折扣 |
| | | * 4.浮动计费拼车如果选中中间特殊位置既享受优惠系数又享受中间特殊位置的优惠折扣 |
| | | */ |
| | | Map<String, Object> query = linePriceMapper.query(lineId, serverCarModelId); |
| | | if(null == query){ |
| | | map.put("distance", 0); |
| | | map.put("price", 0); |
| | | return ResultUtil.success(map); |
| | | } |
| | | String content = query.get("content").toString(); |
| | | JSONObject jsonObject = JSON.parseObject(content); |
| | | if(Integer.valueOf(query.get("type").toString()) == 1){//固定金额 |
| | | double num1 = Double.valueOf(jsonObject.getString("num1")).doubleValue(); |
| | | double num2 = Double.valueOf(jsonObject.getString("num2")).doubleValue(); |
| | | double num3 = Double.valueOf(jsonObject.getString("num3")).doubleValue(); |
| | | double num4 = Double.valueOf(jsonObject.getString("num4")).doubleValue(); |
| | | if(travelMode == 1){//拼车 |
| | | String[] split = seatNumber.split(","); |
| | | boolean b = false; |
| | | for(String s : split){ |
| | | if((totalSeat == 4 && s.equals("3")) || (totalSeat == 6 && s.equals("7"))){ |
| | | b = true; |
| | | break; |
| | | } |
| | | } |
| | | double price1 = 0D; |
| | | if(b){ |
| | | price1 = num1 * (totalSeat == 4 ? num3 : num4); |
| | | peopleNumber -= 1; |
| | | } |
| | | double price = (num1 * peopleNumber) + price1; |
| | | map.put("price", new BigDecimal(price).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | }else{ |
| | | map.put("price", num2);//包车价 |
| | | } |
| | | |
| | | }else{//浮动计费 |
| | | //计算公式:实际历程 * 基础单价 * (参考费用 / (参考里程 * 基础单价)) + (实际历程 - 参考里程) * 基础单价 * 优惠系数 |
| | | double num1 = Double.valueOf(jsonObject.getString("num1")).doubleValue();//参考费用 |
| | | double num2 = Double.valueOf(jsonObject.getString("num2")).doubleValue();//参考里程 |
| | | double num3 = Double.valueOf(jsonObject.getString("num3")).doubleValue();//基础单价 |
| | | double num4 = Double.valueOf(jsonObject.getString("num4")).doubleValue();//优惠系数 |
| | | double num5 = Double.valueOf(jsonObject.getString("num5")).doubleValue();//包车系数 |
| | | double num6 = Double.valueOf(jsonObject.getString("num6")).doubleValue();//五座系数 |
| | | double num7 = Double.valueOf(jsonObject.getString("num7")).doubleValue();//七座系数 |
| | | if(travelMode == 1){//拼车 |
| | | double unitPrice = (distance1 * num3 * (num1 / (num2 * num3))) + ((distance1 - num2) * num3 * num4); |
| | | String[] split = seatNumber.split(","); |
| | | boolean b = false; |
| | | for(String s : split){ |
| | | if((totalSeat == 4 && s.equals("3")) || (totalSeat == 6 && s.equals("5"))){ |
| | | b = true; |
| | | break; |
| | | } |
| | | } |
| | | double price1 = 0D; |
| | | if(b){ |
| | | price1 = unitPrice * (totalSeat == 4 ? num6 : num7); |
| | | peopleNumber -= 1; |
| | | } |
| | | double price = (unitPrice * peopleNumber) + price1; |
| | | map.put("price", new BigDecimal(price).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | }else{ |
| | | double unitPrice = (distance1 * num3 * (num1 / (num2 * num3))) + ((distance1 - num2) * num3 * num5); |
| | | double price = unitPrice * totalSeat; |
| | | map.put("price", new BigDecimal(price).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | } |
| | | } |
| | | return ResultUtil.success(map); |
| | | } |
| | | |
| | | /** |
| | | * 删除定时任务 |
| | | * @param orderId |
| | | */ |
| | | @Override |
| | | public void deleteTask(Integer orderId){ |
| | | //发送验证码短信 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("orderId", orderId + ""); |
| | | params.add("orderType", "3"); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://driver-server/base/netty/deleteTask", requestEntity, String.class); |
| | | JSONObject jsonObject = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject.getIntValue("code") != 200){ |
| | | System.err.println("调用driver-server出错了"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取红包 |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public synchronized ResultUtil<BaseWarpper> queryRedMoney(Integer orderId) throws Exception { |
| | | OrderCrossCity orderCrossCity = this.selectById(orderId); |
| | | Integer companyId = orderCrossCity.getCompanyId(); |
| | | |
| | | Map<String, Object> query = userActivityRedenvelopeService.query(companyId, orderCrossCity.getTravelTime()); |
| | | Double money = 0D; |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | if(null != query){ |
| | | Integer type = Integer.valueOf(String.valueOf(query.get("type"))); |
| | | if(type == 1){//固定金额 |
| | | money = Double.valueOf(String.valueOf(query.get("money"))); |
| | | }else{//随机金额 |
| | | Double startMoney = Double.valueOf(String.valueOf(query.get("startMoney"))); |
| | | Double endMoney = Double.valueOf(String.valueOf(query.get("endMoney"))); |
| | | int i = new BigDecimal(endMoney).subtract(new BigDecimal(startMoney)).intValue(); |
| | | Random random = new Random(); |
| | | int num = random.nextInt(i); |
| | | money = new BigDecimal(startMoney).add(new BigDecimal(num)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } |
| | | //判断当前红包是否大于剩余可领取总金额 |
| | | if(money.compareTo(Double.valueOf(query.get("lavePrice").toString())) > 0){ |
| | | baseWarpper.setAmount(0D); |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | } |
| | | baseWarpper.setAmount(money); |
| | | |
| | | if(money > 0){ |
| | | //添加临时红包数据 |
| | | UserRedPacketRecord userRedPacketRecord = new UserRedPacketRecord(); |
| | | userRedPacketRecord.setMoney(money); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(new Date()); |
| | | calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) + Integer.valueOf(String.valueOf(query.get("effective")))); |
| | | userRedPacketRecord.setExpirationTime(calendar.getTime()); |
| | | userRedPacketRecord.setInsertTime(new Date()); |
| | | userRedPacketRecord.setCompanyId(Integer.valueOf(String.valueOf(query.get("companyId")))); |
| | | userRedPacketRecord.setState(0); |
| | | userRedPacketRecord.setOrderId(orderCrossCity.getId()); |
| | | userRedPacketRecord.setOrderType(3); |
| | | userRedPacketRecord.setUserId(orderCrossCity.getUserId()); |
| | | userRedPacketRecordService.insert(userRedPacketRecord); |
| | | } |
| | | |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分享成功后添加红包 |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public synchronized ResultUtil shareRedEnvelope(Integer orderId) throws Exception { |
| | | OrderCrossCity orderCrossCity = this.selectById(orderId); |
| | | UserRedPacketRecord query = userRedPacketRecordService.query_(orderCrossCity.getUserId(), orderCrossCity.getCompanyId(), 0, 3, null); |
| | | if(null != query){ |
| | | Double money = query.getMoney(); |
| | | Map<String, Object> map = userActivityRedenvelopeService.query(orderCrossCity.getCompanyId(), orderCrossCity.getTravelTime()); |
| | | Double laveMoney = Double.valueOf(String.valueOf(map.get("laveMoney"))); |
| | | if(money.compareTo(laveMoney) > 0){ |
| | | return ResultUtil.error("手速太慢了,红包已派发完啦!"); |
| | | } |
| | | //判断当前红包是否大于剩余可领取总金额 |
| | | if(money.compareTo(Double.valueOf(map.get("lavePrice").toString())) > 0){ |
| | | return ResultUtil.error("手速太慢了,红包已派发完啦!"); |
| | | } |
| | | double v = new BigDecimal(laveMoney).subtract(new BigDecimal(money)).doubleValue(); |
| | | |
| | | UserActivityRedenvelope id = userActivityRedenvelopeService.selectById(String.valueOf(map.get("id"))); |
| | | id.setLaveMoney(v); |
| | | id.setLavePrice(new BigDecimal(id.getLavePrice() - money).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | userActivityRedenvelopeService.updateById(id); |
| | | |
| | | query.setState(1); |
| | | query.setRedPacketActivityId(id.getId()); |
| | | userRedPacketRecordService.updateById(query); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 取消订单支付后的处理 |
| | | * @param id 订单=id |
| | | * @param order_id 工行支付单号 |
| | | * @param type 1=微信,2=支付宝 |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void payCancelOrderCrossCity(Integer id, String order_id, Integer type) throws Exception { |
| | | OrderCrossCity orderCrossCity = this.selectById(id); |
| | | PaymentRecord query = paymentRecordService.query(1, orderCrossCity.getUserId(), 1, Integer.valueOf(id), 3, type, 1); |
| | | if(null != query){ |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderCrossCity.getUserId(), "取消订单", query.getAmount(), 2, 1, 1, 3, query.getOrderId()); |
| | | orderCrossCity.setState(10); |
| | | //解除小号绑定 |
| | | if(orderCrossCity.getBindId() != null){ |
| | | chinaMobileUtil.midAxbUnBindSend(orderCrossCity.getBindId()); |
| | | } |
| | | orderCrossCity.setBindId(""); |
| | | orderCrossCity.setTelX(""); |
| | | this.updateById(orderCrossCity); |
| | | |
| | | query.setState(2); |
| | | query.setCode(order_id); |
| | | paymentRecordService.updateById(query); |
| | | |
| | | OrderCancel query1 = orderCancelService.query(query.getOrderId(), query.getOrderType(), query.getAmount(), query.getPayType(), 1); |
| | | if (null != query1){ |
| | | query1.setState(2); |
| | | orderCancelService.updateById(query1); |
| | | } |
| | | |
| | | //添加已收入明细 |
| | | incomeService.saveData(1, orderCrossCity.getCompanyId(), 3, orderCrossCity.getId(), 3, query.getAmount()); |
| | | |
| | | this.deleteTask(orderCrossCity.getId());//删除定时任务 |
| | | |
| | | // TODO: 2020/5/24 这里需要给司机和用户推送订单状态 |
| | | // new Thread(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // pushUtil.pushOrderState(2, orderCrossCity.getDriverId(), orderCrossCity.getId(), 3, orderCrossCity.getState(), 0); |
| | | // } |
| | | // }).start(); |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, "您已使用" + (type == 1 ? "微信" : "支付宝") + "成功支付取消订单费用,谢谢使用!", orderCrossCity.getUserId(), 1); |
| | | }else{ |
| | | System.err.println("预支付数据异常(orderId = " + id + ")"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取个人中心订单列表 |
| | | * @param uid |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryMyOrderList(Integer uid, Integer pageNum, Integer size) throws Exception { |
| | | pageNum = (pageNum - 1) * size; |
| | | List<Map<String, Object>> maps = orderCrossCityMapper.queryMyOrderList(uid, pageNum, size); |
| | | for(Map<String, Object> map : maps){ |
| | | if(Integer.valueOf(String.valueOf(map.get("state"))) == 11){ |
| | | map.put("state", map.get("oldState")); |
| | | } |
| | | } |
| | | return maps; |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> queryMyTravelRecord(Integer uid) { |
| | | return orderCrossCityMapper.queryMyTravelRecord(uid); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> queryInvoiceOrder(Integer type, Date startTime, Date endTime, Double startMoney, Double endMoney, Integer uid) throws Exception { |
| | | startTime = dateUtil.getStartOrEndDate(startTime, "start"); |
| | | endTime = dateUtil.getStartOrEndDate(endTime, "end"); |
| | | return orderCrossCityMapper.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取红包使用记录 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryRedEnvelope(Integer uid) throws Exception { |
| | | return orderCrossCityMapper.queryRedEnvelope(uid); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加跨城取消(直接取消不需要支付费用,退款) |
| | | * @param id |
| | | * @param reason |
| | | * @param remark |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil addCancle(Integer id, String reason, String remark, Integer uid) throws Exception { |
| | | if(ToolUtil.isNotEmpty(remark)){ |
| | | if(ToolUtil.isNotEmpty(remark)){ |
| | | List<SensitiveWords> sensitiveWords = sensitiveWordsMapper.selectList(null); |
| | | for(SensitiveWords s : sensitiveWords){ |
| | | remark = remark.replaceAll(s.getContent(), "***"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | OrderCrossCity orderCrossCity = this.selectById(id); |
| | | Integer integer = null; |
| | | if(null == orderCrossCity){ |
| | | return ResultUtil.error("取消订单失败,订单信息有误"); |
| | | } |
| | | if(orderCrossCity.getState() > 5 && orderCrossCity.getState() != 7 && orderCrossCity.getState() != 11){ |
| | | return ResultUtil.error("取消订单失败,不合法的操作"); |
| | | } |
| | | |
| | | //还原座位 |
| | | CancleOrder query1 = cancleOrderService.query(1, 3, orderCrossCity.getCompanyId()); |
| | | if (null != query1) { |
| | | integer = orderCancelService.saveData(id, 3, reason, remark, null, null, 2, 1, uid); |
| | | orderCrossCity.setState(10); |
| | | this.updateById(orderCrossCity); |
| | | |
| | | if(orderCrossCity.getState() != 7){//已经支付的情况推送给司机提醒 |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(2, orderCrossCity.getDriverId(), orderCrossCity.getId(), 3, orderCrossCity.getState(), 0); |
| | | System.err.println("推送取消操作---------------------"); |
| | | } |
| | | }).start(); |
| | | } |
| | | |
| | | //修改司机座位 |
| | | LineShiftDriver lineShiftDriver = lineShiftDriverMapper.selectById(orderCrossCity.getLineShiftDriverId()); |
| | | lineShiftDriver.setLaveSeat(lineShiftDriver.getLaveSeat() + orderCrossCity.getPeopleNumber()); |
| | | lineShiftDriver.setLaveSeatNumber(lineShiftDriver.getLaveSeatNumber() + (orderCrossCity.getTravelMode() == 1 ? "," : "") + orderCrossCity.getSeatNumber()); |
| | | lineShiftDriverMapper.updateById(lineShiftDriver); |
| | | |
| | | //修改司机为空闲 |
| | | List<OrderCrossCity> orderCrossCities = orderCrossCityMapper.queryByDriverId(orderCrossCity.getDriverId(), 2, 3, 4, 5, 11); |
| | | if(orderCrossCities.size() == 0){ |
| | | Driver driver = driverService.selectById(orderCrossCity.getDriverId()); |
| | | driver.setState(2); |
| | | driverService.updateById(driver); |
| | | } |
| | | }else{ |
| | | return ResultUtil.error("请完善后台取消规则设置"); |
| | | } |
| | | |
| | | //已支付的情况下进行退款操作 |
| | | if(null != orderCrossCity.getPayType() && null != orderCrossCity.getPayMoney()){ |
| | | if(orderCrossCity.getPayType() == 3){//余额支付 |
| | | UserInfo userInfo = userInfoService.selectById(orderCrossCity.getUserId()); |
| | | userInfo.setBalance(userInfo.getBalance() + orderCrossCity.getPayMoney()); |
| | | userInfoService.updateById(userInfo); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderCrossCity.getUserId(), "跨城订单取消退款", orderCrossCity.getPayMoney(), 1, 1, 1, 3, id); |
| | | }else{ |
| | | PaymentRecord query = paymentRecordService.query(1, orderCrossCity.getUserId(), 1, id, 3, orderCrossCity.getPayType(), 2); |
| | | if(null == query){ |
| | | query = paymentRecordService.query(1, orderCrossCity.getDriverId(), 2, id, 3, orderCrossCity.getPayType(), 2); |
| | | if(null == query){ |
| | | return ResultUtil.error("订单还未进行支付"); |
| | | } |
| | | } |
| | | |
| | | if(query.getPayType() == 1){//微信 |
| | | Map<String, String> map = payMoneyUtil.wxRefund(query.getCode(), id + "_3", query.getAmount().toString(), query.getAmount().toString(), "/base/cancleOrderWXPay"); |
| | | if(!"SUCCESS".equals(map.get("return_code"))){ |
| | | return ResultUtil.error(map.get("return_msg")); |
| | | } |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(query.getUserId(), "跨城订单取消退款", query.getAmount(), 1, 1, query.getType(), 3, id); |
| | | }else{//支付宝 |
| | | Map<String, String> map = payMoneyUtil.aliRefund(query.getCode(), query.getAmount().toString()); |
| | | if(!"10000".equals(map.get("code"))){ |
| | | return ResultUtil.error(map.get("msg")); |
| | | } |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(query.getUserId(), "跨城订单取消退款", query.getAmount(), 1, 1, query.getType(), 3, id); |
| | | } |
| | | |
| | | |
| | | // PaymentRecord query = paymentRecordService.query(1, orderCrossCity.getUserId(), 1, id, 3, orderCrossCity.getPayType(), 2); |
| | | // if(null == query){ |
| | | // return ResultUtil.error("订单还未进行支付"); |
| | | // } |
| | | // Map<String, Object> merrefund = icbcPayUtil.merrefund(query.getCode(), "", query.getAmount(), id + "_3", orderCrossCity.getOrderNum()); |
| | | // if(Integer.valueOf(merrefund.get("code").toString()) == 0){ |
| | | // Map<String, Object> refundqry = icbcPayUtil.refundqry("", query.getCode(), orderCrossCity.getOrderNum()); |
| | | // if(Integer.valueOf(refundqry.get("code").toString()) == 0 && Integer.valueOf(refundqry.get("pay_status").toString()) == 0){//成功 |
| | | // //添加交易明细 |
| | | // transactionDetailsService.saveData(orderCrossCity.getUserId(), "跨城订单取消退款", query.getAmount(), 1, 1, 1, 3, id); |
| | | // } |
| | | // if(Integer.valueOf(refundqry.get("code").toString()) == 0 && Integer.valueOf(refundqry.get("pay_status").toString()) == 1){//失败 |
| | | // return ResultUtil.error("订单取消失败(退款不成功)"); |
| | | // } |
| | | // if(Integer.valueOf(refundqry.get("code").toString()) == 0 && Integer.valueOf(refundqry.get("pay_status").toString()) == 2){//未知 |
| | | // return ResultUtil.error("退款返回未知异常"); |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | //添加负的收入明细 |
| | | List<Income> incomes = incomeService.selectList(new EntityWrapper<Income>().eq("type", 2).eq("incomeId", id).eq("orderType", 3)); |
| | | for(Income income : incomes){ |
| | | if(income.getUserType() == 2){//处理司机的收入 |
| | | Driver driver = driverService.selectById(income.getObjectId()); |
| | | driver.setBalance(driver.getBalance() - income.getMoney()); |
| | | driver.setBusinessMoney(driver.getBusinessMoney() - income.getMoney()); |
| | | driver.setLaveBusinessMoney(driver.getLaveBusinessMoney() - income.getMoney()); |
| | | driverService.updateById(driver); |
| | | } |
| | | Income income1 = new Income(); |
| | | BeanUtils.copyProperties(income, income1); |
| | | income1.setMoney(income.getMoney() * -1); |
| | | income1.setId(null); |
| | | income1.setInsertTime(new Date()); |
| | | incomeService.insert(income1); |
| | | } |
| | | } |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, "您已成功取消出行订单,谢谢使用!", orderCrossCity.getUserId(), 1); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", integer); |
| | | return ResultUtil.success(map); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取服务中的订单数据 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public OrderServerWarpper queryOrderServer(Integer orderId, Integer uid) throws Exception { |
| | | OrderCrossCity orderCrossCity = this.selectById(orderId); |
| | | //计算预计距离和剩余时间 |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(orderCrossCity.getDriverId())); |
| | | if(null == value || "".equals(value)){ |
| | | System.err.println("司机没有上传位置信息"); |
| | | |
| | | //调用获取轨迹中的数据 |
| | | List<Map<String, Object>> list = orderPositionService.queryTrack(orderId, 3); |
| | | if(list.size() > 0){ |
| | | Map<String, Object> map = list.get(list.size() - 1); |
| | | value = map.get("lon") + "," + map.get("lat"); |
| | | } |
| | | |
| | | } |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(value, orderCrossCity.getStartLon() + "," + orderCrossCity.getStartLat(), 1); |
| | | String d = "0"; |
| | | String t = "0"; |
| | | if(null == distance){ |
| | | System.err.println("查询距离出错了"); |
| | | }else{ |
| | | d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000), new MathContext(2, RoundingMode.HALF_EVEN)).toString(); |
| | | t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).intValue() + ""; |
| | | } |
| | | OrderServerWarpper orderServerWarpper = new OrderServerWarpper(); |
| | | orderServerWarpper.setOrderId(orderCrossCity.getId()); |
| | | orderServerWarpper.setOrderType(3); |
| | | orderServerWarpper.setState(orderCrossCity.getState()); |
| | | orderServerWarpper.setLon(null != value ? value.split(",")[0] : "0.0"); |
| | | orderServerWarpper.setLat(null != value ? value.split(",")[1] : "0.0"); |
| | | orderServerWarpper.setReassignNotice(orderCrossCity.getReassignNotice()); |
| | | if(orderCrossCity.getState() == 2 || orderCrossCity.getState() == 3){//前往预约地 |
| | | orderServerWarpper.setReservationMileage(d); |
| | | orderServerWarpper.setReservationTime(t); |
| | | orderServerWarpper.setServedMileage("0"); |
| | | orderServerWarpper.setServedTime("0"); |
| | | orderServerWarpper.setLaveMileage("0"); |
| | | orderServerWarpper.setLaveTime("0"); |
| | | } |
| | | if(orderCrossCity.getState() == 5 || orderCrossCity.getState() == 6){//服务中 |
| | | distance = gdMapElectricFenceUtil.getDistance(value, orderCrossCity.getEndLon() + "," + orderCrossCity.getEndLat(), 1); |
| | | if(null == distance){ |
| | | System.err.println("查询距离出错了"); |
| | | }else{ |
| | | d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000), new MathContext(2, RoundingMode.HALF_EVEN)).toPlainString(); |
| | | t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).intValue() + ""; |
| | | } |
| | | orderServerWarpper.setReservationMileage("0"); |
| | | orderServerWarpper.setReservationTime("0"); |
| | | orderServerWarpper.setServedMileage(String.valueOf(orderCrossCity.getMileage() / 1000)); |
| | | orderServerWarpper.setServedTime(Long.valueOf((new Date().getTime() - orderCrossCity.getStartServiceTime().getTime()) / 60000).intValue() + ""); |
| | | orderServerWarpper.setLaveMileage(d); |
| | | orderServerWarpper.setLaveTime(t); |
| | | } |
| | | |
| | | return orderServerWarpper; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 摆渡下单 |
| | | * @param serverCarModelIds |
| | | * @param travelTime |
| | | * @param placementLon |
| | | * @param placementLat |
| | | * @param startLon |
| | | * @param startLat |
| | | * @param startAddress |
| | | * @param endLon |
| | | * @param endLat |
| | | * @param endAddress |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ResultUtil<BaseWarpper> saveOrderFerry(String serverCarModelIds, Date travelTime, String placementLon, String placementLat, String startLon, |
| | | String startLat, String startAddress, String endLon, String endLat, String endAddress, Integer crossCityOrderId, |
| | | Integer place, Integer orderSource, Integer uid,String name,String phone) throws Exception { |
| | | if(ToolUtil.isEmpty(serverCarModelIds)){ |
| | | return ResultUtil.error("请选择服务车型"); |
| | | } |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(startLon, startLat); |
| | | boolean b = openCityService.openCity(geocode.get("districtCode")); |
| | | if(!b){ |
| | | return ResultUtil.error("起点暂未开通"); |
| | | } |
| | | |
| | | String[] split = serverCarModelIds.split(","); |
| | | List<Map<String, Integer>> list = new ArrayList<>(); |
| | | Integer orderId = null; |
| | | for(String serverModelId : split){ |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | if(serverModelId.equals("0")){//出租车 |
| | | ResultUtil<BaseWarpper> resultUtil = this.orderText(travelTime, placementLon, placementLat, startLon, startLat, startAddress, endLon, endLat, endAddress, crossCityOrderId, place, orderSource, uid); |
| | | if(resultUtil.getCode() != 200){ |
| | | return resultUtil; |
| | | } |
| | | map.put("orderType", 2); |
| | | map.put("orderId", resultUtil.getData().getId()); |
| | | }else{ |
| | | ResultUtil<BaseWarpper> resultUtil = this.orderPrivateCar(Integer.valueOf(serverModelId), travelTime, placementLon, placementLat, startLon, startLat, startAddress, endLon, endLat, endAddress, crossCityOrderId, place, orderSource, uid,name,phone); |
| | | if(resultUtil.getCode() != 200){ |
| | | return resultUtil; |
| | | } |
| | | map.put("orderType", 1); |
| | | map.put("orderId", resultUtil.getData().getId()); |
| | | orderId = resultUtil.getData().getId(); |
| | | } |
| | | list.add(map); |
| | | } |
| | | //推单操作 |
| | | this.pushOrder(list); |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setId(null == orderId ? list.get(0).get("orderId") : orderId); |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 出租车摆渡单 |
| | | * @param travelTime |
| | | * @param placementLon |
| | | * @param placementLat |
| | | * @param startLon |
| | | * @param startLat |
| | | * @param startAddress |
| | | * @param endLon |
| | | * @param endLat |
| | | * @param endAddress |
| | | * @param orderSource |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | private synchronized ResultUtil<BaseWarpper> orderText(Date travelTime, String placementLon, String placementLat, String startLon, String startLat, |
| | | String startAddress, String endLon, String endLat, String endAddress, Integer crossCityOrderId, Integer place, Integer orderSource, Integer uid) throws Exception{ |
| | | //定义用户所属公司 |
| | | OrderTaxi orderTaxi = new OrderTaxi(); |
| | | UserInfo userInfo1 = userInfoService.selectById(uid); |
| | | Company query = companyCityService.query(startLon, startLat); |
| | | if(null == query){ |
| | | return ResultUtil.error("出发点暂未开通"); |
| | | } |
| | | if(null != userInfo1.getCompanyId() && 0 != userInfo1.getCompanyId()){ |
| | | userInfo1.setCompanyId(query.getId()); |
| | | userInfoService.updateById(userInfo1); |
| | | } |
| | | |
| | | if(travelTime.getTime() > (System.currentTimeMillis() + 600000)){ |
| | | orderTaxi.setOrderType(2); |
| | | } |
| | | |
| | | orderTaxi.setType(2); |
| | | orderTaxi.setCrossCityOrderId(crossCityOrderId); |
| | | orderTaxi.setPlace(place); |
| | | orderTaxi.setSubstitute(0); |
| | | orderTaxi.setOrderType(1); |
| | | orderTaxi.setOrderSource(orderSource); |
| | | orderTaxi.setTravelTime(travelTime); |
| | | orderTaxi.setPlacementLon(Double.valueOf(placementLon)); |
| | | orderTaxi.setPlacementLat(Double.valueOf(placementLat)); |
| | | orderTaxi.setStartLon(Double.valueOf(startLon)); |
| | | orderTaxi.setStartLat(Double.valueOf(startLat)); |
| | | orderTaxi.setStartAddress(startAddress); |
| | | orderTaxi.setEndLon(Double.valueOf(endLon)); |
| | | orderTaxi.setEndLat(Double.valueOf(endLat)); |
| | | orderTaxi.setEndAddress(endAddress); |
| | | orderTaxi.setOrderNum(orderTaxiService.getOrderNum()); |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(placementLon, placementLat); |
| | | orderTaxi.setPlacementAddress(geocode.get("address")); |
| | | String startAddress1 = orderTaxi.getStartAddress(); |
| | | startAddress1 = startAddress1.replaceAll("& #40;", "("); |
| | | startAddress1 = startAddress1.replaceAll("& #41;", ")"); |
| | | orderTaxi.setStartAddress(startAddress1);//特殊字符转义 |
| | | String endAddress1 = orderTaxi.getEndAddress(); |
| | | endAddress1 = endAddress1.replaceAll("& #40;", "("); |
| | | endAddress1 = endAddress1.replaceAll("& #41;", ")"); |
| | | orderTaxi.setEndAddress(endAddress1); |
| | | orderTaxi.setUserId(uid); |
| | | orderTaxi.setMileage(0D); |
| | | orderTaxi.setOrderMoney(0D); |
| | | orderTaxi.setTravelMoney(0D); |
| | | orderTaxi.setParkMoney(0D); |
| | | orderTaxi.setRoadTollMoney(0D); |
| | | orderTaxi.setRedPacketMoney(0D); |
| | | orderTaxi.setCouponMoney(0D); |
| | | orderTaxi.setInsertTime(new Date()); |
| | | orderTaxi.setIsReassign(1); |
| | | if(orderTaxi.getSubstitute() == 0){//不是代下单 |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | if(ToolUtil.isEmpty(userInfo.getPhone())){ |
| | | return ResultUtil.error("请先绑定手机号码"); |
| | | } |
| | | orderTaxi.setPassengers(userInfo.getName()); |
| | | orderTaxi.setPassengersPhone(userInfo.getPhone()); |
| | | } |
| | | orderTaxi.setState(1);//待接单 |
| | | |
| | | orderTaxiService.insert(orderTaxi); |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, "您的出租车订单已下单成功,我们正在为您指派司机,请稍后!", orderTaxi.getUserId(), 1); |
| | | |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setId(orderTaxi.getId()); |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 专车摆渡单 |
| | | * @param serverCarModelId |
| | | * @param travelTime |
| | | * @param placementLon |
| | | * @param placementLat |
| | | * @param startLon |
| | | * @param startLat |
| | | * @param startAddress |
| | | * @param endLon |
| | | * @param endLat |
| | | * @param endAddress |
| | | * @param orderSource |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | private synchronized ResultUtil<BaseWarpper> orderPrivateCar(Integer serverCarModelId, Date travelTime, String placementLon, String placementLat, String startLon, String startLat, |
| | | String startAddress, String endLon, String endLat, String endAddress, Integer crossCityOrderId, Integer place, Integer orderSource, Integer uid,String name,String phone) throws Exception{ |
| | | //如果出行时间大于当前10分钟则默认为预约单 |
| | | Integer reservation = 1; |
| | | if(travelTime.getTime() > (System.currentTimeMillis() + 600000)){ |
| | | reservation = 2; |
| | | } |
| | | |
| | | startAddress = startAddress.replaceAll("& #40;", "("); |
| | | startAddress = startAddress.replaceAll("& #41;", ")"); |
| | | endAddress = endAddress.replaceAll("& #40;", "("); |
| | | endAddress = endAddress.replaceAll("& #41;", ")"); |
| | | if((orderSource == 1 || orderSource == 3) && null == serverCarModelId){ |
| | | return ResultUtil.error("请选择服务车型"); |
| | | } |
| | | |
| | | OrderPrivateCar orderPrivateCar = new OrderPrivateCar(); |
| | | orderPrivateCar.setType(2); |
| | | orderPrivateCar.setCrossCityOrderId(crossCityOrderId); |
| | | orderPrivateCar.setPlace(place); |
| | | orderPrivateCar.setUserId(uid); |
| | | orderPrivateCar.setServerCarModelId(serverCarModelId); |
| | | orderPrivateCar.setOrderNum(orderPrivateCarService.getOrderNum()); |
| | | orderPrivateCar.setPlacementLon(Double.valueOf(placementLon)); |
| | | orderPrivateCar.setPlacementLat(Double.valueOf(placementLat)); |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(placementLon, placementLat); |
| | | orderPrivateCar.setPlacementAddress(geocode.get("address")); |
| | | orderPrivateCar.setStartLon(Double.valueOf(startLon)); |
| | | orderPrivateCar.setStartLat(Double.valueOf(startLat)); |
| | | orderPrivateCar.setStartAddress(startAddress); |
| | | orderPrivateCar.setEndLon(Double.valueOf(endLon)); |
| | | orderPrivateCar.setEndLat(Double.valueOf(endLat)); |
| | | orderPrivateCar.setEndAddress(endAddress); |
| | | orderPrivateCar.setSubstitute(0); |
| | | orderPrivateCar.setPassengers(name); |
| | | orderPrivateCar.setPassengersPhone(phone); |
| | | if(orderPrivateCar.getSubstitute() == 0 || ToolUtil.isEmpty(orderPrivateCar.getPassengers())){ |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | if(ToolUtil.isEmpty(userInfo.getPhone())){ |
| | | return ResultUtil.error("请先绑定手机号码"); |
| | | } |
| | | orderPrivateCar.setPassengers(userInfo.getName()); |
| | | orderPrivateCar.setPassengersPhone(userInfo.getPhone()); |
| | | } |
| | | orderPrivateCar.setState(1); |
| | | orderPrivateCar.setInsertTime(new Date()); |
| | | orderPrivateCar.setTravelTime(travelTime); |
| | | orderPrivateCar.setOrderType(reservation); |
| | | orderPrivateCar.setOrderSource(orderSource); |
| | | |
| | | orderPrivateCar.setIsReassign(1); |
| | | orderPrivateCar.setIsDelete(1); |
| | | orderPrivateCarMapper.insert(orderPrivateCar); |
| | | |
| | | //添加消息 systemNoticeService.addSystemNotice(1, "您的专车订单已下单成功,我们正在为您指派司机,请稍后!", orderPrivateCar.getUserId(), 1); |
| | | |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setId(orderPrivateCar.getId()); |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 摆渡车推单操作 |
| | | * @param list |
| | | * @throws Exception |
| | | */ |
| | | public void pushOrder(List<Map<String, Integer>> list) throws Exception{ |
| | | System.err.println("====="+list); |
| | | for(Map<String, Integer> map : list){ |
| | | Integer orderType = map.get("orderType"); |
| | | Integer orderId1 = map.get("orderId"); |
| | | Thread thread = new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | List<Map<String, Integer>> datas = list; |
| | | final Integer orderId = orderId1; |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | List<Integer> integers = new ArrayList<>(); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | integers = JSON.parseArray(vehicle).toJavaList(Integer.class); |
| | | } |
| | | try { |
| | | if(orderType == 1){//专车 |
| | | Thread.sleep(1000); |
| | | System.err.println("====="+orderId); |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarMapper.selectById(orderId); |
| | | System.err.println("====="+orderPrivateCar); |
| | | OrderPrivateCarServiceImpl.orderIds.add(orderPrivateCar.getId());//添加记录,防止调用接口重复提醒无人接单 |
| | | Company query = companyCityService.query(String.valueOf(orderPrivateCar.getStartLon()), String.valueOf(orderPrivateCar.getStartLat()));//获取起点所属分公司 |
| | | List<PushOrder> querys = pushOrderService.querys(null, 1, query.getId());//获取需要推送的次数 |
| | | for(int i = 1; i <= querys.size(); i++){ |
| | | //订单被抢后的处理 |
| | | Integer state = orderPrivateCarMapper.selectById(orderId).getState(); |
| | | if(state != 1){ |
| | | //关闭其他推送线程 |
| | | Set<String> keySet = threadMap.keySet(); |
| | | for(String key : keySet){ |
| | | if(!key.equals(orderId + "_1")){ |
| | | Thread thread1 = threadMap.get(key);//中断线程 |
| | | if(null != thread1){ |
| | | thread1.interrupt(); |
| | | } |
| | | threadMap.remove(key); |
| | | } |
| | | } |
| | | //删除其他无效数据 |
| | | for(Map<String, Integer> map : datas){ |
| | | Integer orderType = map.get("orderType"); |
| | | Integer orderId1 = map.get("orderId"); |
| | | if(orderType == 1 && orderId != orderPrivateCar.getId()){ |
| | | orderPrivateCarMapper.deleteById(orderId1); |
| | | } |
| | | if(orderType == 2){ |
| | | orderTaxiMapper.deleteById(orderId1); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | |
| | | //开始进行推送的处理 |
| | | PushOrder pushOrder = pushOrderService.querys(i, 1, query.getId()).get(0); |
| | | //获取空闲司机 |
| | | List<Driver> list = driverService.queryIdleDriver(1, orderPrivateCar.getServerCarModelId(), orderPrivateCar.getStartLon(), orderPrivateCar.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机 |
| | | if(list.size() > 0){ |
| | | double driverProportion = pushOrder.getDriverProportion() / 100;//推送占比计算成小数 |
| | | int lastIndex = Double.valueOf(list.size() * driverProportion).intValue();//计算占比转成整数(下标截取) |
| | | list = list.subList(0, lastIndex);//获取空闲司机中占比数据 |
| | | for(Driver driver : list){//开始进行推送 |
| | | boolean bo = false; |
| | | for(Integer integer : integers){ |
| | | if(integer.compareTo(driver.getId()) == 0){ |
| | | bo = true; |
| | | break; |
| | | } |
| | | } |
| | | if(bo){ |
| | | continue; |
| | | } |
| | | pushUtil.pushOrderState(2, driver.getId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), pushOrder.getPushTime()); |
| | | } |
| | | } |
| | | |
| | | //所有推送完后的处理 |
| | | Boolean b = pushEndMap.get(orderPrivateCar.getCrossCityOrderId()); |
| | | if(i == querys.size() && state == 1 && (null != b && !b.booleanValue())){ |
| | | pushUtil.pushEndPush(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1); |
| | | OrderPrivateCarServiceImpl.orderIds.remove(orderPrivateCar.getId()); |
| | | pushEndMap.put(orderPrivateCar.getCrossCityOrderId(), Boolean.TRUE);//推送后添加标识 |
| | | break; |
| | | } |
| | | Thread.sleep(pushOrder.getPushTime() * 1000);//设置等待时间 |
| | | } |
| | | } |
| | | |
| | | if(orderType == 2){//出租车 |
| | | OrderTaxi orderTaxi = orderTaxiMapper.selectById(orderId); |
| | | OrderTaxiServiceImpl.orderIds.add(orderTaxi.getId());//添加记录,防止调用接口重复提醒无人接单 |
| | | Company query = companyCityService.query(String.valueOf(orderTaxi.getStartLon()), String.valueOf(orderTaxi.getStartLat()));//获取起点所属分公司 |
| | | List<PushOrder> querys = pushOrderService.querys(null, 2, query.getId());//获取需要推送的次数 |
| | | for(int i = 1; i <= querys.size(); i++){ |
| | | //处理订单被抢 |
| | | Integer state = orderTaxiMapper.selectById(orderId).getState(); |
| | | if(state != 1){ |
| | | //关闭其他推送任务 |
| | | Set<String> keySet = threadMap.keySet(); |
| | | for(String key : keySet){ |
| | | if(!key.equals(orderId + "_2")){ |
| | | Thread thread1 = threadMap.get(key);//中断线程 |
| | | if(null != thread1){ |
| | | thread1.interrupt(); |
| | | } |
| | | threadMap.remove(key); |
| | | } |
| | | } |
| | | //删除其他无效数据 |
| | | for(Map<String, Integer> map : datas){ |
| | | Integer orderType = map.get("orderType"); |
| | | Integer orderId1 = map.get("orderId"); |
| | | if(orderType == 1){ |
| | | orderPrivateCarMapper.deleteById(orderId1); |
| | | } |
| | | if(orderType == 2 && orderId1 != orderTaxi.getId()){ |
| | | orderTaxiMapper.deleteById(orderId1); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | |
| | | //开始进行推送 |
| | | PushOrder pushOrder = pushOrderService.querys(i, 2, query.getId()).get(0); |
| | | //获取空闲司机 |
| | | List<Driver> list = driverService.queryIdleDriver(2, orderTaxi.getStartLon(), orderTaxi.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机 |
| | | if(list.size() > 0){ |
| | | double driverProportion = pushOrder.getDriverProportion() / 100;//推送占比计算成小数 |
| | | int lastIndex = Double.valueOf(list.size() * driverProportion).intValue();//计算占比转成整数(下标截取) |
| | | list = list.subList(0, lastIndex);//获取空闲司机中占比数据 |
| | | for(Driver driver : list){//开始进行推送 |
| | | boolean bo = false; |
| | | for(Integer integer : integers){ |
| | | if(integer.compareTo(driver.getId()) == 0){ |
| | | bo = true; |
| | | break; |
| | | } |
| | | } |
| | | if(bo){ |
| | | continue; |
| | | } |
| | | |
| | | |
| | | pushUtil.pushOrderState(2, driver.getId(), orderTaxi.getId(), 2, orderTaxi.getState(), pushOrder.getPushTime()); |
| | | } |
| | | } |
| | | |
| | | //所有推送完后的处理 |
| | | Boolean b = pushEndMap.get(orderTaxi.getCrossCityOrderId()); |
| | | if(i == querys.size() && state == 1 && (null != b && !b.booleanValue())){ |
| | | pushUtil.pushEndPush(1, orderTaxi.getUserId(), orderTaxi.getId(), 2); |
| | | OrderTaxiServiceImpl.orderIds.remove(orderTaxi.getId()); |
| | | pushEndMap.put(orderTaxi.getCrossCityOrderId(), Boolean.TRUE);//推送后添加标识 |
| | | } |
| | | Thread.sleep(pushOrder.getPushTime() * 1000);//设置等待时间 |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }); |
| | | thread.start(); |
| | | threadMap.put(orderId1 + "_" + orderType, thread); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<OrderCrossCity> queryListOrder(Integer driverId, Integer lineShiftId, List<Integer> state, String day) throws Exception { |
| | | return orderCrossCityMapper.queryListOrder(driverId, lineShiftId, state, day); |
| | | } |
| | | |
| | | /** |
| | | * 获取订单编号 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public synchronized String getOrderNum(Integer driverId, Integer lineShiftDriverId) throws Exception{ |
| | | List<OrderCrossCity> orderCrossCities = orderCrossCityMapper.queryOrders(driverId, lineShiftDriverId, Arrays.asList(2, 3, 4, 7)); |
| | | if(orderCrossCities.size() > 0){ |
| | | return orderCrossCities.get(0).getOrderNum(); |
| | | } |
| | | int size = this.selectCount(null); |
| | | while (true){ |
| | | String orderNum = "CROSS" + String.valueOf(1000000 + size + 1).substring(1); |
| | | List<OrderCrossCity> orderNum1 = this.selectList(new EntityWrapper<OrderCrossCity>().eq("orderNum", orderNum)); |
| | | if(orderNum1.size() == 0){ |
| | | return orderNum; |
| | | } |
| | | size++; |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.server.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.crossCity.dao.LocationMapper; |
| | | import com.stylefeng.guns.modular.crossCity.dao.SiteMapper; |
| | | import com.stylefeng.guns.modular.crossCity.model.Site; |
| | | import com.stylefeng.guns.modular.crossCity.server.ISiteService; |
| | | import com.stylefeng.guns.modular.crossCity.warpper.SiteWarpper; |
| | | import com.stylefeng.guns.modular.system.util.GDMapElectricFenceUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | |
| | | |
| | | @Service |
| | | public class SiteServiceImpl extends ServiceImpl<SiteMapper, Site> implements ISiteService { |
| | | |
| | | @Resource |
| | | private SiteMapper siteMapper; |
| | | |
| | | @Resource |
| | | private LocationMapper locationMapper; |
| | | |
| | | @Autowired |
| | | private GDMapElectricFenceUtil gdMapElectricFenceUtil; |
| | | |
| | | |
| | | /** |
| | | * 获取站点 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<SiteWarpper> querySite(Integer startSiteId) throws Exception { |
| | | List<Map<String, Object>> sites = null; |
| | | if(null == startSiteId){ |
| | | sites = siteMapper.querySite(null); |
| | | }else{ |
| | | sites = siteMapper.querySite(startSiteId); |
| | | } |
| | | Set<String> set = new HashSet<>(); |
| | | for(Map<String, Object> site : sites) { |
| | | set.add(site.get("cityCode").toString()); |
| | | } |
| | | |
| | | List<SiteWarpper> list = new ArrayList<>(); |
| | | for(String c : set){ |
| | | SiteWarpper siteWarpper = new SiteWarpper(); |
| | | List<Object> data = new ArrayList<>(); |
| | | String name = ""; |
| | | String code = ""; |
| | | for(Map<String, Object> s : sites){ |
| | | if(c.equals(s.get("cityCode").toString())){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", s.get("id")); |
| | | map.put("name", s.get("name").toString()); |
| | | name = s.get("cityName").toString(); |
| | | code = s.get("cityCode").toString(); |
| | | data.add(map); |
| | | } |
| | | } |
| | | siteWarpper.setName(name); |
| | | siteWarpper.setCode(code); |
| | | siteWarpper.setSites(data); |
| | | list.add(siteWarpper); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 判断点是都在区域范围内 |
| | | * @param siteId |
| | | * @param code |
| | | * @param lonLat |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public boolean areaMonitoring(Integer siteId, String code, String lonLat) throws Exception { |
| | | List<Map<String, Object>> list = this.queryLocation(siteId); |
| | | for(Map<String, Object> map : list){ |
| | | if(Integer.valueOf(map.get("type").toString()) == 1){//行政区域 |
| | | if(null != map.get("districtCode")){ |
| | | if(code.equals(map.get("districtCode").toString())){ |
| | | return true; |
| | | } |
| | | continue; |
| | | } |
| | | if(null != map.get("cityCode")){ |
| | | if(code.equals(map.get("cityCode").toString())){ |
| | | return true; |
| | | } |
| | | code = code.substring(0, 4) + "00"; |
| | | if(code.equals(map.get("cityCode").toString())){ |
| | | return true; |
| | | } |
| | | continue; |
| | | } |
| | | if(null != map.get("provinceCode")){ |
| | | code = code.substring(0, 2) + "0000"; |
| | | if(code.equals(map.get("provinceCode").toString())){ |
| | | return true; |
| | | } |
| | | continue; |
| | | } |
| | | } |
| | | if(Integer.valueOf(map.get("type").toString()) == 2){//电子围栏 |
| | | String gid = map.get("gid").toString(); |
| | | List<String> list1 = gdMapElectricFenceUtil.monitorElectricFenc("", lonLat); |
| | | if(list1.contains(gid)){ |
| | | return true; |
| | | } |
| | | continue; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 根据站点id获取地点区域 |
| | | * @param siteId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryLocation(Integer siteId) throws Exception { |
| | | return locationMapper.queryLocation(siteId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @ApiModel("线路排班") |
| | | public class LineSiteWarpper { |
| | | @ApiModelProperty("班次id") |
| | | private Integer id; |
| | | @ApiModelProperty("司机预约排班id") |
| | | private Integer lineShiftDriverId; |
| | | @ApiModelProperty("发车时间") |
| | | private String startTime; |
| | | @ApiModelProperty("司机头像") |
| | | private String headImgUrl; |
| | | @ApiModelProperty("司机姓名") |
| | | private String name; |
| | | @ApiModelProperty("车牌") |
| | | private String carLicensePlate; |
| | | @ApiModelProperty("车辆品牌") |
| | | private String brand; |
| | | @ApiModelProperty("车辆颜色") |
| | | private String carColor; |
| | | @ApiModelProperty("座位数") |
| | | private String number; |
| | | @ApiModelProperty("评分") |
| | | private Double evaluate; |
| | | @ApiModelProperty("预估价") |
| | | private Double price; |
| | | @ApiModelProperty("司机id") |
| | | private Integer driverId; |
| | | @ApiModelProperty("车辆id") |
| | | private Integer carId; |
| | | @ApiModelProperty("车辆总座位数") |
| | | private Integer totalSeat; |
| | | @ApiModelProperty("服务车型id") |
| | | private Integer serverCarModelId; |
| | | @ApiModelProperty("剩余座位编号") |
| | | private String laveSeatNumber; |
| | | @ApiModelProperty("剩余座位数") |
| | | private Integer laveSeat; |
| | | |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getLineShiftDriverId() { |
| | | return lineShiftDriverId; |
| | | } |
| | | |
| | | public void setLineShiftDriverId(Integer lineShiftDriverId) { |
| | | this.lineShiftDriverId = lineShiftDriverId; |
| | | } |
| | | |
| | | public String getStartTime() { |
| | | return startTime; |
| | | } |
| | | |
| | | public void setStartTime(String startTime) { |
| | | this.startTime = startTime; |
| | | } |
| | | |
| | | public String getHeadImgUrl() { |
| | | return headImgUrl; |
| | | } |
| | | |
| | | public void setHeadImgUrl(String headImgUrl) { |
| | | this.headImgUrl = headImgUrl; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getCarLicensePlate() { |
| | | return carLicensePlate; |
| | | } |
| | | |
| | | public void setCarLicensePlate(String carLicensePlate) { |
| | | this.carLicensePlate = carLicensePlate; |
| | | } |
| | | |
| | | public String getBrand() { |
| | | return brand; |
| | | } |
| | | |
| | | public void setBrand(String brand) { |
| | | this.brand = brand; |
| | | } |
| | | |
| | | public String getCarColor() { |
| | | return carColor; |
| | | } |
| | | |
| | | public void setCarColor(String carColor) { |
| | | this.carColor = carColor; |
| | | } |
| | | |
| | | public String getNumber() { |
| | | return number; |
| | | } |
| | | |
| | | public void setNumber(String number) { |
| | | this.number = number; |
| | | } |
| | | |
| | | public Double getEvaluate() { |
| | | return evaluate; |
| | | } |
| | | |
| | | public void setEvaluate(Double evaluate) { |
| | | this.evaluate = evaluate; |
| | | } |
| | | |
| | | public Double getPrice() { |
| | | return price; |
| | | } |
| | | |
| | | public void setPrice(Double price) { |
| | | this.price = price; |
| | | } |
| | | |
| | | public Integer getDriverId() { |
| | | return driverId; |
| | | } |
| | | |
| | | public void setDriverId(Integer driverId) { |
| | | this.driverId = driverId; |
| | | } |
| | | |
| | | public Integer getCarId() { |
| | | return carId; |
| | | } |
| | | |
| | | public void setCarId(Integer carId) { |
| | | this.carId = carId; |
| | | } |
| | | |
| | | public Integer getTotalSeat() { |
| | | return totalSeat; |
| | | } |
| | | |
| | | public void setTotalSeat(Integer totalSeat) { |
| | | this.totalSeat = totalSeat; |
| | | } |
| | | |
| | | public Integer getServerCarModelId() { |
| | | return serverCarModelId; |
| | | } |
| | | |
| | | public void setServerCarModelId(Integer serverCarModelId) { |
| | | this.serverCarModelId = serverCarModelId; |
| | | } |
| | | |
| | | public String getLaveSeatNumber() { |
| | | return laveSeatNumber; |
| | | } |
| | | |
| | | public void setLaveSeatNumber(String laveSeatNumber) { |
| | | this.laveSeatNumber = laveSeatNumber; |
| | | } |
| | | |
| | | public Integer getLaveSeat() { |
| | | return laveSeat; |
| | | } |
| | | |
| | | public void setLaveSeat(Integer laveSeat) { |
| | | this.laveSeat = laveSeat; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "LineSiteWarpper{" + |
| | | "id=" + id + |
| | | ", startTime='" + startTime + '\'' + |
| | | ", headImgUrl='" + headImgUrl + '\'' + |
| | | ", name='" + name + '\'' + |
| | | ", carLicensePlate='" + carLicensePlate + '\'' + |
| | | ", brand='" + brand + '\'' + |
| | | ", carColor='" + carColor + '\'' + |
| | | ", number='" + number + '\'' + |
| | | ", evaluate=" + evaluate + |
| | | ", price=" + price + |
| | | ", driverId=" + driverId + |
| | | ", carId=" + carId + |
| | | ", totalSeat=" + totalSeat + |
| | | ", serverCarModelId=" + serverCarModelId + |
| | | ", laveSeatNumber='" + laveSeatNumber + '\'' + |
| | | ", laveSeat=" + laveSeat + |
| | | '}'; |
| | | } |
| | | |
| | | public static List<LineSiteWarpper> getLineSiteWarppers(List<Map<String, Object>> list){ |
| | | List<LineSiteWarpper> data = new ArrayList<>(); |
| | | if(null != list){ |
| | | for(Map<String, Object> map : list){ |
| | | if(null != map){ |
| | | LineSiteWarpper lineSiteWarpper = new LineSiteWarpper(); |
| | | lineSiteWarpper.setId(null != map.get("id") ? Integer.valueOf(map.get("id").toString()) : 0); |
| | | lineSiteWarpper.setLineShiftDriverId(null != map.get("lineShiftDriverId") ? Integer.valueOf(map.get("lineShiftDriverId").toString()) : 0); |
| | | lineSiteWarpper.setStartTime(null != map.get("startTime") ? map.get("startTime").toString() : ""); |
| | | lineSiteWarpper.setHeadImgUrl(null != map.get("headImgUrl") ? map.get("headImgUrl").toString() : ""); |
| | | lineSiteWarpper.setName(null != map.get("name") ? map.get("name").toString() : ""); |
| | | lineSiteWarpper.setCarLicensePlate(null != map.get("carLicensePlate") ? map.get("carLicensePlate").toString() : ""); |
| | | lineSiteWarpper.setBrand(null != map.get("brand") ? map.get("brand").toString() : ""); |
| | | lineSiteWarpper.setCarColor(null != map.get("carColor") ? map.get("carColor").toString() : ""); |
| | | lineSiteWarpper.setNumber(null != map.get("number") ? map.get("number").toString() : ""); |
| | | lineSiteWarpper.setEvaluate(null != map.get("evaluate") ? Double.valueOf(map.get("evaluate").toString()) : 0); |
| | | lineSiteWarpper.setPrice(null != map.get("price") ? Double.valueOf(map.get("price").toString()) : 0); |
| | | lineSiteWarpper.setDriverId(null != map.get("driverId") ? Integer.valueOf(map.get("driverId").toString()) : 0); |
| | | lineSiteWarpper.setCarId(null != map.get("carId") ? Integer.valueOf(map.get("carId").toString()) : 0); |
| | | lineSiteWarpper.setTotalSeat(null != map.get("totalSeat") ? Integer.valueOf(map.get("totalSeat").toString()) : 0); |
| | | lineSiteWarpper.setServerCarModelId(null != map.get("serverCarModelId") ? Integer.valueOf(map.get("serverCarModelId").toString()) : 0); |
| | | lineSiteWarpper.setLaveSeatNumber(null != map.get("laveSeatNumber") ? map.get("laveSeatNumber").toString() : ""); |
| | | lineSiteWarpper.setLaveSeat(null != map.get("laveSeat") ? Integer.valueOf(map.get("laveSeat").toString()) : 0); |
| | | data.add(lineSiteWarpper); |
| | | } |
| | | } |
| | | } |
| | | return data; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @ApiModel("线路") |
| | | public class LineWarpper { |
| | | @ApiModelProperty("线路id") |
| | | private Integer id; |
| | | @ApiModelProperty("线路名称") |
| | | private String name; |
| | | @ApiModelProperty("起点") |
| | | private String startAddress; |
| | | @ApiModelProperty("终点") |
| | | private String endAddress; |
| | | |
| | | 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 getStartAddress() { |
| | | return startAddress; |
| | | } |
| | | |
| | | public void setStartAddress(String startAddress) { |
| | | this.startAddress = startAddress; |
| | | } |
| | | |
| | | public String getEndAddress() { |
| | | return endAddress; |
| | | } |
| | | |
| | | public void setEndAddress(String endAddress) { |
| | | this.endAddress = endAddress; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "LineWarpper{" + |
| | | "id=" + id + |
| | | ", name='" + name + '\'' + |
| | | ", startAddress='" + startAddress + '\'' + |
| | | ", endAddress='" + endAddress + '\'' + |
| | | '}'; |
| | | } |
| | | |
| | | |
| | | public static LineWarpper getLineWarpper(Map<String, Object> map){ |
| | | LineWarpper lineWarpper = new LineWarpper(); |
| | | if(null != map){ |
| | | lineWarpper.setId(null != map.get("id") ? Integer.valueOf(map.get("id").toString()) : 0); |
| | | lineWarpper.setName(null != map.get("name") ? map.get("name").toString() : ""); |
| | | lineWarpper.setStartAddress(null != map.get("startAddress") ? map.get("startAddress").toString() : ""); |
| | | lineWarpper.setEndAddress(null != map.get("endAddress") ? map.get("endAddress").toString() : ""); |
| | | } |
| | | return lineWarpper; |
| | | } |
| | | |
| | | |
| | | public static List<LineWarpper> getLineWarppers(List<Map<String, Object>> maps){ |
| | | List<LineWarpper> list = new ArrayList<>(); |
| | | if(null != maps){ |
| | | for(Map<String, Object> map : maps){ |
| | | list.add(LineWarpper.getLineWarpper(map)); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @ApiModel("站点区域") |
| | | public class LocationWarpper { |
| | | @ApiModelProperty("区域类型(1=行政区域,2=电子围栏)") |
| | | private Integer type; |
| | | @ApiModelProperty("省名称") |
| | | private String province; |
| | | @ApiModelProperty("省编号") |
| | | private String provinceCode; |
| | | @ApiModelProperty("市名称") |
| | | private String city; |
| | | @ApiModelProperty("市编号") |
| | | private String cityCode; |
| | | @ApiModelProperty("区县名称") |
| | | private String district; |
| | | @ApiModelProperty("区县编号") |
| | | private String districtCode; |
| | | @ApiModelProperty("电子围栏坐标多组以分号分隔") |
| | | private String coordinate; |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getProvince() { |
| | | return province; |
| | | } |
| | | |
| | | public void setProvince(String province) { |
| | | this.province = province; |
| | | } |
| | | |
| | | public String getProvinceCode() { |
| | | return provinceCode; |
| | | } |
| | | |
| | | public void setProvinceCode(String provinceCode) { |
| | | this.provinceCode = provinceCode; |
| | | } |
| | | |
| | | public String getCity() { |
| | | return city; |
| | | } |
| | | |
| | | public void setCity(String city) { |
| | | this.city = city; |
| | | } |
| | | |
| | | public String getCityCode() { |
| | | return cityCode; |
| | | } |
| | | |
| | | public void setCityCode(String cityCode) { |
| | | this.cityCode = cityCode; |
| | | } |
| | | |
| | | public String getDistrict() { |
| | | return district; |
| | | } |
| | | |
| | | public void setDistrict(String district) { |
| | | this.district = district; |
| | | } |
| | | |
| | | public String getDistrictCode() { |
| | | return districtCode; |
| | | } |
| | | |
| | | public void setDistrictCode(String districtCode) { |
| | | this.districtCode = districtCode; |
| | | } |
| | | |
| | | public String getCoordinate() { |
| | | return coordinate; |
| | | } |
| | | |
| | | public void setCoordinate(String coordinate) { |
| | | this.coordinate = coordinate; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "LocationWarpper{" + |
| | | "type=" + type + |
| | | ", province='" + province + '\'' + |
| | | ", provinceCode='" + provinceCode + '\'' + |
| | | ", city='" + city + '\'' + |
| | | ", cityCode='" + cityCode + '\'' + |
| | | ", district='" + district + '\'' + |
| | | ", districtCode='" + districtCode + '\'' + |
| | | ", coordinate='" + coordinate + '\'' + |
| | | '}'; |
| | | } |
| | | |
| | | |
| | | public static List<LocationWarpper> getLocationWarppers(List<Map<String, Object>> list){ |
| | | List<LocationWarpper> data = new ArrayList<>(); |
| | | if(null != list){ |
| | | for(Map<String, Object> map : list){ |
| | | if(null != map){ |
| | | LocationWarpper locationWarpper = new LocationWarpper(); |
| | | locationWarpper.setType(null != map.get("type") ? Integer.valueOf(map.get("type").toString()) : 0); |
| | | locationWarpper.setProvince(null != map.get("province") ? map.get("province").toString() : ""); |
| | | locationWarpper.setProvinceCode(null != map.get("provinceCode") ? map.get("provinceCode").toString() : ""); |
| | | locationWarpper.setCity(null != map.get("city") ? map.get("city").toString() : ""); |
| | | locationWarpper.setCityCode(null != map.get("cityCode") ? map.get("cityCode").toString() : ""); |
| | | locationWarpper.setDistrict(null != map.get("district") ? map.get("district").toString() : ""); |
| | | locationWarpper.setDistrictCode(null != map.get("districtCode") ? map.get("districtCode").toString() : ""); |
| | | locationWarpper.setCoordinate(null != map.get("coordinate") ? map.get("coordinate").toString() : ""); |
| | | data.add(locationWarpper); |
| | | } |
| | | } |
| | | } |
| | | return data; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.warpper; |
| | | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @ApiModel("跨城订单") |
| | | public class OrderCrossCityWarpper { |
| | | @ApiModelProperty(value = "服务车型id", required = true, dataType = "int") |
| | | private Integer serverCarModelId; |
| | | @ApiModelProperty(value = "司机预约排班id", required = true, dataType = "int") |
| | | private Integer lineShiftDriverId; |
| | | @ApiModelProperty(value = "司机id", required = true, dataType = "int") |
| | | private Integer driverId; |
| | | @ApiModelProperty(value = "线路id", required = true, dataType = "int") |
| | | private Integer lineId; |
| | | @ApiModelProperty(value = "车辆id", required = true, dataType = "int") |
| | | private Integer carId; |
| | | @ApiModelProperty(value = "下单地点经度", required = true, dataType = "double") |
| | | private Double placementLon; |
| | | @ApiModelProperty(value = "下单地点纬度", required = true, dataType = "double") |
| | | private Double placementLat; |
| | | @ApiModelProperty(value = "下单详细地址", required = true, dataType = "string") |
| | | private String placementAddress; |
| | | @ApiModelProperty(value = "起点经度", required = true, dataType = "double") |
| | | private Double startLon; |
| | | @ApiModelProperty(value = "起点纬度", required = true, dataType = "double") |
| | | private Double startLat; |
| | | @ApiModelProperty(value = "起点", required = true, dataType = "string") |
| | | private String startAddress; |
| | | @ApiModelProperty(value = "终点经度", required = true, dataType = "double") |
| | | private Double endLon; |
| | | @ApiModelProperty(value = "终点纬度", required = true, dataType = "double") |
| | | private Double endLat; |
| | | @ApiModelProperty(value = "终点详细地址", required = true, dataType = "string") |
| | | private String endAddress; |
| | | @ApiModelProperty(value = "出行时间(2020-09-04 12:00:00)", required = true, dataType = "string") |
| | | private Date travelTime; |
| | | @ApiModelProperty(value = "出行方式(1=拼车,2=包车)", required = true, dataType = "int") |
| | | private Integer travelMode; |
| | | @ApiModelProperty(value = "订单来源(1:APP下单,2:扫码下单,3:小程序下单,4:司机下单,5:调度下单)", required = true, dataType = "int") |
| | | private Integer orderSource; |
| | | @ApiModelProperty(value = "出行人数", required = true, dataType = "int") |
| | | private Integer peopleNumber; |
| | | @ApiModelProperty(value = "乘车人id[1,2,3]", required = true, dataType = "string") |
| | | private String frequentPassengersId; |
| | | @ApiModelProperty(value = "车辆总座位数", required = true, dataType = "int") |
| | | private Integer totalSeat; |
| | | @ApiModelProperty(value = "座位编号(1,3,4)", required = true, dataType = "string") |
| | | private String seatNumber; |
| | | @ApiModelProperty(value = "备注", required = false, dataType = "string") |
| | | private String remark; |
| | | @ApiModelProperty(value = "行驶里程数", required = true, dataType = "double") |
| | | private Double distance; |
| | | |
| | | public Integer getServerCarModelId() { |
| | | return serverCarModelId; |
| | | } |
| | | |
| | | public void setServerCarModelId(Integer serverCarModelId) { |
| | | this.serverCarModelId = serverCarModelId; |
| | | } |
| | | |
| | | public Integer getLineShiftDriverId() { |
| | | return lineShiftDriverId; |
| | | } |
| | | |
| | | public void setLineShiftDriverId(Integer lineShiftDriverId) { |
| | | this.lineShiftDriverId = lineShiftDriverId; |
| | | } |
| | | |
| | | public Integer getDriverId() { |
| | | return driverId; |
| | | } |
| | | |
| | | public void setDriverId(Integer driverId) { |
| | | this.driverId = driverId; |
| | | } |
| | | |
| | | public Integer getLineId() { |
| | | return lineId; |
| | | } |
| | | |
| | | public void setLineId(Integer lineId) { |
| | | this.lineId = lineId; |
| | | } |
| | | |
| | | public Integer getCarId() { |
| | | return carId; |
| | | } |
| | | |
| | | public void setCarId(Integer carId) { |
| | | this.carId = carId; |
| | | } |
| | | |
| | | public Double getPlacementLon() { |
| | | return placementLon; |
| | | } |
| | | |
| | | public void setPlacementLon(Double placementLon) { |
| | | this.placementLon = placementLon; |
| | | } |
| | | |
| | | public Double getPlacementLat() { |
| | | return placementLat; |
| | | } |
| | | |
| | | public void setPlacementLat(Double placementLat) { |
| | | this.placementLat = placementLat; |
| | | } |
| | | |
| | | public String getPlacementAddress() { |
| | | return placementAddress; |
| | | } |
| | | |
| | | public void setPlacementAddress(String placementAddress) { |
| | | this.placementAddress = placementAddress; |
| | | } |
| | | |
| | | public Double getStartLon() { |
| | | return startLon; |
| | | } |
| | | |
| | | public void setStartLon(Double startLon) { |
| | | this.startLon = startLon; |
| | | } |
| | | |
| | | public Double getStartLat() { |
| | | return startLat; |
| | | } |
| | | |
| | | public void setStartLat(Double startLat) { |
| | | this.startLat = startLat; |
| | | } |
| | | |
| | | public String getStartAddress() { |
| | | return startAddress; |
| | | } |
| | | |
| | | public void setStartAddress(String startAddress) { |
| | | this.startAddress = startAddress; |
| | | } |
| | | |
| | | public Double getEndLon() { |
| | | return endLon; |
| | | } |
| | | |
| | | public void setEndLon(Double endLon) { |
| | | this.endLon = endLon; |
| | | } |
| | | |
| | | public Double getEndLat() { |
| | | return endLat; |
| | | } |
| | | |
| | | public void setEndLat(Double endLat) { |
| | | this.endLat = endLat; |
| | | } |
| | | |
| | | public String getEndAddress() { |
| | | return endAddress; |
| | | } |
| | | |
| | | public void setEndAddress(String endAddress) { |
| | | this.endAddress = endAddress; |
| | | } |
| | | |
| | | public Date getTravelTime() { |
| | | return travelTime; |
| | | } |
| | | |
| | | public void setTravelTime(Date travelTime) { |
| | | this.travelTime = travelTime; |
| | | } |
| | | |
| | | public Integer getTravelMode() { |
| | | return travelMode; |
| | | } |
| | | |
| | | public void setTravelMode(Integer travelMode) { |
| | | this.travelMode = travelMode; |
| | | } |
| | | |
| | | public Integer getOrderSource() { |
| | | return orderSource; |
| | | } |
| | | |
| | | public void setOrderSource(Integer orderSource) { |
| | | this.orderSource = orderSource; |
| | | } |
| | | |
| | | public Integer getTotalSeat() { |
| | | return totalSeat; |
| | | } |
| | | |
| | | public void setTotalSeat(Integer totalSeat) { |
| | | this.totalSeat = totalSeat; |
| | | } |
| | | |
| | | public Integer getPeopleNumber() { |
| | | return peopleNumber; |
| | | } |
| | | |
| | | public void setPeopleNumber(Integer peopleNumber) { |
| | | this.peopleNumber = peopleNumber; |
| | | } |
| | | |
| | | public String getFrequentPassengersId() { |
| | | return frequentPassengersId; |
| | | } |
| | | |
| | | public void setFrequentPassengersId(String frequentPassengersId) { |
| | | this.frequentPassengersId = frequentPassengersId; |
| | | } |
| | | |
| | | public String getSeatNumber() { |
| | | return seatNumber; |
| | | } |
| | | |
| | | public void setSeatNumber(String seatNumber) { |
| | | this.seatNumber = seatNumber; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public Double getDistance() { |
| | | return distance; |
| | | } |
| | | |
| | | public void setDistance(Double distance) { |
| | | this.distance = distance; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.crossCity.warpper; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.List; |
| | | |
| | | @ApiModel("站点") |
| | | public class SiteWarpper { |
| | | @ApiModelProperty("所属地区名称") |
| | | private String name; |
| | | @ApiModelProperty("所属地区编号") |
| | | private String code; |
| | | @ApiModelProperty("站点列表") |
| | | private List<Object> sites; |
| | | |
| | | 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 List<Object> getSites() { |
| | | return sites; |
| | | } |
| | | |
| | | public void setSites(List<Object> sites) { |
| | | this.sites = sites; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.smallLogistics.controller; |
| | | |
| | | |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.system.model.Region; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 小件物流控制器 |
| | | */ |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class OrderLogisticsController { |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | |
| | | /** |
| | | * 根据起点和终点坐标判断是不是同一个市内 |
| | | * @param startLonLat |
| | | * @param endAddress |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/orderLogistics/judgingTheCity") |
| | | @ApiOperation(value = "根据起点和终点坐标判断是不是同一个市内", tags = {"用户端-小件物流"}, notes = "只有在选择了同城小件物流的时候调用") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "起点经纬度(103.23265,30.2312)", name = "startLonLat", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "终点详细地址", name = "endAddress", required = true, paramType = "query", dataType = "string") |
| | | }) |
| | | public ResultUtil judgingTheCity(String startLonLat, String endAddress){ |
| | | try { |
| | | return orderLogisticsService.judgingTheCity(startLonLat, endAddress); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/orderLogistics/queryLogisticsUnitPrice") |
| | | @ApiOperation(value = "获取小件物流的单价数据", tags = {"用户端-小件物流"}, notes = "ordinary(普通物品),precious(贵重物品),first=0(首次下单)") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "业务类型(4=同城小件物流,5=跨城小件物流)", name = "type", required = true, paramType = "query", dataType = "int"), |
| | | @ApiImplicitParam(value = "起点经纬度(103.23265,30.2312)", name = "startLonLat", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "终点详细地址", name = "endAddress", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil queryLogisticsUnitPrice(Integer type, String startLonLat, String endAddress, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return orderLogisticsService.queryLogisticsUnitPrice(type, startLonLat, endAddress, uid); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/orderLogistics/queryPayMoney") |
| | | @ApiOperation(value = "获取支付金额", tags = {"用户端-小件物流"}, notes = "ordinary(普通物品),precious(贵重物品)") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "货物数量", name = "number", required = true, paramType = "query", dataType = "int"), |
| | | @ApiImplicitParam(value = "业务类型(4=同城小件物流,5=跨城小件物流)", name = "type", required = true, paramType = "query", dataType = "int"), |
| | | @ApiImplicitParam(value = "起点经纬度(103.23265,30.2312)", name = "startLonLat", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "终点详细地址", name = "endAddress", required = true, paramType = "query", dataType = "string") |
| | | }) |
| | | public ResultUtil queryPayMoney(Integer number, Integer type, String startLonLat, String endAddress){ |
| | | try { |
| | | return orderLogisticsService.queryPayMoney(number, type, startLonLat, endAddress); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 小件物流下单操作 |
| | | * @param type |
| | | * @param cargoType |
| | | * @param cargoNumber |
| | | * @param remark |
| | | * @param placementLon |
| | | * @param placementLat |
| | | * @param startLon |
| | | * @param startLat |
| | | * @param startAddress |
| | | * @param recipient |
| | | * @param recipientPhone |
| | | * @param endAddress |
| | | * @param travelTime |
| | | * @param orderSource |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/orderLogistics/smallLogistics") |
| | | @ApiOperation(value = "小件物流下单操作(同城/跨城)", tags = {"用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "业务类型(4=同城小件物流,5=跨城小件物流)", name = "type", required = true, paramType = "query", dataType = "int"), |
| | | @ApiImplicitParam(value = "货物类型(1=普通货物,2=贵重货物)", name = "cargoType", required = true, paramType = "query", dataType = "int"), |
| | | @ApiImplicitParam(value = "货物数量", name = "cargoNumber", required = true, paramType = "query", dataType = "int"), |
| | | @ApiImplicitParam(value = "备注", name = "remark", required = false, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "下单点经度(103.23265,30.2312)", name = "placementLon", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "下单点纬度(103.23265,30.2312)", name = "placementLat", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "预约取货点经度(103.23265,30.2312)", name = "startLon", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "预约取货点纬度(103.23265,30.2312)", name = "startLat", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "预约取货点详细地址", name = "startAddress", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "收货人姓名", name = "recipient", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "收货人电话", name = "recipientPhone", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "收货详细地址", name = "endAddress", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "是否加急(1=否,2=是)", name = "urgent", required = true, paramType = "query", dataType = "int"), |
| | | @ApiImplicitParam(value = "加急费用", name = "tipMoney", required = true, paramType = "query", dataType = "double"), |
| | | @ApiImplicitParam(value = "预约收货时间(2020-09-17 21:00:00)", name = "travelTime", required = true, paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(value = "下单方式(1:APP下单,2:扫码下单,3:小程序下单,4:司机下单,5:调度下单)", name = "orderSource", required = true, paramType = "query", dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<BaseWarpper> smallLogistics(Integer type, Integer cargoType, Integer cargoNumber, String remark, String placementLon, String placementLat, String startLon, String startLat, String startAddress, |
| | | String recipient, String recipientPhone, String endAddress, Integer urgent, Double tipMoney, Date travelTime, Integer orderSource, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return orderLogisticsService.smallLogistics(type, cargoType, cargoNumber, remark, placementLon, placementLat, startLon, startLat, startAddress, recipient, recipientPhone, endAddress, urgent, tipMoney, travelTime, orderSource, uid); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/orderLogistics/queryLogisticsNumber") |
| | | @ApiOperation(value = "获取首页小件物流订单数量", tags = {"用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<BaseWarpper> queryLogisticsNumber(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | int i = orderLogisticsService.queryLogisticsNumber(uid); |
| | | BaseWarpper baseWarppe = new BaseWarpper(); |
| | | baseWarppe.setNumber(i); |
| | | return ResultUtil.success(baseWarppe); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/orderLogistics/payOrderLogisticsSpread") |
| | | @ApiOperation(value = "小件物流补差价支付", tags = {"用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "支付方式(1=微信,2=支付宝,3=余额)", name = "payType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "支付端(1=用户APP端,2=司机APP端,3=用户小程序端)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil payOrderLogisticsSpread(Integer orderId, Integer payType, Integer type, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return orderLogisticsService.payLogisticsOrder_(payType, orderId, type); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取行政区域数据(小程序) |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/orderLogistics/queryRegion") |
| | | public Map<String, Object> queryRegion(){ |
| | | try { |
| | | Map<String, Object> map = orderLogisticsService.queryRegion(); |
| | | return map; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/orderLogistics/queryRegions") |
| | | @ApiOperation(value = "获取行政区域三级联动数据", tags = {"用户端-小件物流"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "上级id。第一层传0", name = "parentId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil queryRegions(Integer parentId){ |
| | | try { |
| | | List<Region> regions = orderLogisticsService.queryRegions(parentId); |
| | | return ResultUtil.success(regions); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.smallLogistics.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface OrderLogisticsMapper extends BaseMapper<OrderLogistics> { |
| | | |
| | | |
| | | List<OrderLogistics> query(@Param("start") Date start, @Param("end") Date end); |
| | | |
| | | |
| | | /** |
| | | * 获取个人待完成订单数量 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | int queryLogisticsNumber(@Param("uid") Integer uid); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取用户的订单列表 |
| | | * @param uid |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryMyOrderList(@Param("uid") Integer uid, @Param("pageNum") Integer pageNum, |
| | | @Param("size") Integer size); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取历史消费记录 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryMyTravelRecord(@Param("uid") Integer uid); |
| | | |
| | | |
| | | /** |
| | | * 获取用户单发票页面的订单列表 |
| | | * @param type 开票状态(1=未开票,2=已开票) |
| | | * @param startTime 订单开始时间 |
| | | * @param endTime 订单结束时间 |
| | | * @param startMoney 订单金额范围 |
| | | * @param endMoney |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryInvoiceOrder(@Param("type") Integer type, @Param("startTime") Date startTime, |
| | | @Param("endTime") Date endTime, @Param("startMoney") Double startMoney, |
| | | @Param("endMoney") Double endMoney, @Param("uid") Integer uid, |
| | | @Param("orderType") Integer orderType); |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.smallLogistics.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogisticsSpread; |
| | | |
| | | public interface OrderLogisticsSpreadMapper extends BaseMapper<OrderLogisticsSpread> { |
| | | } |
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.stylefeng.guns.modular.smallLogistics.dao.OrderLogisticsMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics"> |
| | | <id column="id" property="id"/> |
| | | <result column="type" property="type"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="driverId" property="driverId"/> |
| | | <result column="carId" property="carId"/> |
| | | <result column="orderNum" property="orderNum"/> |
| | | <result column="cargoType" property="cargoType"/> |
| | | <result column="number" property="number"/> |
| | | <result column="urgent" property="urgent"/> |
| | | <result column="cargoNumber" property="cargoNumber"/> |
| | | <result column="remark" property="remark"/> |
| | | <result column="placementLon" property="placementLon"/> |
| | | <result column="placementLat" property="placementLat"/> |
| | | <result column="placementAddress" property="placementAddress"/> |
| | | <result column="startLon" property="startLon"/> |
| | | <result column="startLat" property="startLat"/> |
| | | <result column="startAddress" property="startAddress"/> |
| | | <result column="endLon" property="endLon"/> |
| | | <result column="endLat" property="endLat"/> |
| | | <result column="endAddress" property="endAddress"/> |
| | | <result column="recipient" property="recipient"/> |
| | | <result column="recipientPhone" property="recipientPhone"/> |
| | | <result column="boardingLon" property="boardingLon"/> |
| | | <result column="boardingLat" property="boardingLat"/> |
| | | <result column="boardingAddress" property="boardingAddress"/> |
| | | <result column="boardingTime" property="boardingTime"/> |
| | | <result column="getoffLon" property="getoffLon"/> |
| | | <result column="getoffLat" property="getoffLat"/> |
| | | <result column="getoffAddress" property="getoffAddress"/> |
| | | <result column="getoffTime" property="getoffTime"/> |
| | | <result column="mileage" property="mileage"/> |
| | | <result column="payManner" property="payManner"/> |
| | | <result column="payType" property="payType"/> |
| | | <result column="orderMoney" property="orderMoney"/> |
| | | <result column="travelMoney" property="travelMoney"/> |
| | | <result column="tipMoney" property="tipMoney"/> |
| | | <result column="redPacketMoney" property="redPacketMoney"/> |
| | | <result column="couponMoney" property="couponMoney"/> |
| | | <result column="redPacketId" property="redPacketId"/> |
| | | <result column="couponId" property="couponId"/> |
| | | <result column="discount" property="discount"/> |
| | | <result column="discountMoney" property="discountMoney"/> |
| | | <result column="activityId" property="activityId"/> |
| | | <result column="companyId" property="companyId"/> |
| | | <result column="payMoney" property="payMoney"/> |
| | | <result column="state" property="state"/> |
| | | <result column="insertTime" property="insertTime"/> |
| | | <result column="travelTime" property="travelTime"/> |
| | | <result column="snatchOrderTime" property="snatchOrderTime"/> |
| | | <result column="setOutTime" property="setOutTime"/> |
| | | <result column="arriveTime" property="arriveTime"/> |
| | | <result column="startServiceTime" property="startServiceTime"/> |
| | | <result column="endServiceTime" property="endServiceTime"/> |
| | | <result column="orderSource" property="orderSource"/> |
| | | <result column="invoiceId" property="invoiceId"/> |
| | | <result column="trackId" property="trackId"/> |
| | | <result column="isDelete" property="isDelete"/> |
| | | <result column="telX" property="telX"/> |
| | | <result column="bindId" property="bindId"/> |
| | | <result column="pickUpCode" property="pickUpCode"/> |
| | | <result column="isReassign" property="isReassign"/> |
| | | <result column="reassignNotice" property="reassignNotice"/> |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | | <select id="query" resultType="OrderLogistics"> |
| | | select |
| | | id as id, |
| | | type as type, |
| | | userId as userId, |
| | | driverId as driverId, |
| | | carId as carId, |
| | | orderNum as orderNum, |
| | | cargoType as cargoType, |
| | | cargoNumber as cargoNumber, |
| | | remark as remark, |
| | | placementLon as placementLon, |
| | | placementLat as placementLat, |
| | | placementAddress as placementAddress, |
| | | startLon as startLon, |
| | | startLat as startLat, |
| | | startAddress as startAddress, |
| | | endLon as endLon, |
| | | endLat as endLat, |
| | | endAddress as endAddress, |
| | | recipient as recipient, |
| | | recipientPhone as recipientPhone, |
| | | boardingLon as boardingLon, |
| | | boardingLat as boardingLat, |
| | | boardingAddress as boardingAddress, |
| | | boardingTime as boardingTime, |
| | | getoffLon as getoffLon, |
| | | getoffLat as getoffLat, |
| | | getoffAddress as getoffAddress, |
| | | getoffTime as getoffTime, |
| | | mileage as mileage, |
| | | payManner as payManner, |
| | | payType as payType, |
| | | orderMoney as orderMoney, |
| | | travelMoney as travelMoney, |
| | | tipMoney as tipMoney, |
| | | redPacketMoney as redPacketMoney, |
| | | couponMoney as couponMoney, |
| | | redPacketId as redPacketId, |
| | | couponId as couponId, |
| | | discount as discount, |
| | | discountMoney as discountMoney, |
| | | activityId as activityId, |
| | | companyId as companyId, |
| | | payMoney as payMoney, |
| | | state as state, |
| | | insertTime as insertTime, |
| | | travelTime as travelTime, |
| | | snatchOrderTime as snatchOrderTime, |
| | | setOutTime as setOutTime, |
| | | arriveTime as arriveTime, |
| | | startServiceTime as startServiceTime, |
| | | endServiceTime as endServiceTime, |
| | | orderSource as orderSource, |
| | | invoiceId as invoiceId, |
| | | trackId as trackId, |
| | | isDelete as isDelete, |
| | | telX as telX, |
| | | bindId as bindId |
| | | from t_order_logistics where isDelete = 1 |
| | | <if test="null != start and null != end"> |
| | | and insertTime between #{start} and #{end} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryLogisticsNumber" resultType="int"> |
| | | select |
| | | count(id) |
| | | from t_order_logistics where isDelete = 1 and state in (1, 2, 3, 4, 5, 7) and userId = #{uid} |
| | | </select> |
| | | |
| | | |
| | | <select id="queryMyOrderList" resultType="map"> |
| | | select |
| | | id as orderId, |
| | | DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i') as orderTime, |
| | | DATE_FORMAT(travelTime, '%Y-%m-%d %H:%i') as time, |
| | | endAddress as endAddress, |
| | | startAddress as startAddress, |
| | | CONCAT((if(cargoType = 1, '普通小件', '普通大件')), 'X', cargoNumber) as cargoType, |
| | | driverId as driverId, |
| | | `type` as orderType, |
| | | state as state, |
| | | orderMoney as orderMoney, |
| | | payMoney as payMoney, |
| | | (select price from t_order_logistics_spread where orderLogisticsId = a.id) as differenceMoney |
| | | from t_order_logistics as a where userId = #{uid} order by insertTime desc limit #{pageNum}, #{size} |
| | | </select> |
| | | |
| | | |
| | | <select id="queryMyTravelRecord" resultType="map"> |
| | | select |
| | | (payMoney * -1) as money, |
| | | DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i') as time, |
| | | if(type = 4, '同城小件物流订单', '跨城小件物流') as name, |
| | | UNIX_TIMESTAMP(insertTime) as insertTime |
| | | from t_order_logistics where (payMoney != 0 or payMoney is not null) and userId = #{uid} order by insertTime desc |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryInvoiceOrder" resultType="map"> |
| | | select |
| | | id as id, |
| | | DATE_FORMAT(travelTime, '%Y-%m-%d %H:%i') as time, |
| | | startAddress as startAddress, |
| | | endAddress as endAddress, |
| | | payMoney as payMoney, |
| | | if(type = 4, '同城小件物流订单', '跨城小件物流订单') as orderName, |
| | | if(invoiceId is null, 1, 2) as invoice, |
| | | unix_timestamp(insertTime) as insertTime, |
| | | `type` as orderType |
| | | from t_order_logistics where state in (9) |
| | | <if test="type == 1"> |
| | | and invoiceId is null and invoiceId in (select id from t_invoice where state != 2) |
| | | </if> |
| | | <if test="type == 2"> |
| | | and invoiceId in (select id from t_invoice where state = 2) |
| | | </if> |
| | | <if test="null != startTime and null != endTime"> |
| | | and travelTime between #{startTime} and #{endTime} |
| | | </if> |
| | | <if test="null != startMoney and null != endMoney"> |
| | | and payMoney between #{startMoney} and #{endMoney} |
| | | </if> |
| | | <if test="null !=uid"> |
| | | and userId = #{uid} |
| | | </if> |
| | | <if test="null != orderType"> |
| | | and `type` = #{orderType} |
| | | </if> |
| | | </select> |
| | | </mapper> |
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.stylefeng.guns.modular.smallLogistics.dao.OrderLogisticsSpreadMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.smallLogistics.model.OrderLogisticsSpread"> |
| | | <id column="id" property="id"/> |
| | | <result column="orderLogisticsId" property="orderLogisticsId"/> |
| | | <result column="price" property="price"/> |
| | | <result column="payType" property="payType"/> |
| | | <result column="payTime" property="payTime"/> |
| | | <result column="payMoney" property="payMoney"/> |
| | | </resultMap> |
| | | </mapper> |
New file |
| | |
| | | package com.stylefeng.guns.modular.smallLogistics.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 小件物流订单 |
| | | */ |
| | | @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; |
| | | /** |
| | | * 货物类型(1=普通货物,2=贵重货物) |
| | | */ |
| | | @TableField("cargoType") |
| | | private Integer cargoType; |
| | | /** |
| | | * 是否加急(1=否,2=是) |
| | | */ |
| | | @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=余额) |
| | | */ |
| | | @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=已支付差价) |
| | | */ |
| | | @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=是) |
| | | */ |
| | | @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=已改派)用于通知前端获取新司机数据 |
| | | */ |
| | | @TableField("reassignNotice") |
| | | private Integer reassignNotice; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Integer getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public Integer getDriverId() { |
| | | return driverId; |
| | | } |
| | | |
| | | public void setDriverId(Integer driverId) { |
| | | this.driverId = driverId; |
| | | } |
| | | |
| | | public Integer getCarId() { |
| | | return carId; |
| | | } |
| | | |
| | | public void setCarId(Integer carId) { |
| | | this.carId = carId; |
| | | } |
| | | |
| | | public String getOrderNum() { |
| | | return orderNum; |
| | | } |
| | | |
| | | public void setOrderNum(String orderNum) { |
| | | this.orderNum = orderNum; |
| | | } |
| | | |
| | | public Integer getCargoType() { |
| | | return cargoType; |
| | | } |
| | | |
| | | public void setCargoType(Integer cargoType) { |
| | | this.cargoType = cargoType; |
| | | } |
| | | |
| | | public Integer getUrgent() { |
| | | return urgent; |
| | | } |
| | | |
| | | public void setUrgent(Integer urgent) { |
| | | this.urgent = urgent; |
| | | } |
| | | |
| | | public Integer getCargoNumber() { |
| | | return cargoNumber; |
| | | } |
| | | |
| | | public void setCargoNumber(Integer cargoNumber) { |
| | | this.cargoNumber = cargoNumber; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public Double getPlacementLon() { |
| | | return placementLon; |
| | | } |
| | | |
| | | public void setPlacementLon(Double placementLon) { |
| | | this.placementLon = placementLon; |
| | | } |
| | | |
| | | public Double getPlacementLat() { |
| | | return placementLat; |
| | | } |
| | | |
| | | public void setPlacementLat(Double placementLat) { |
| | | this.placementLat = placementLat; |
| | | } |
| | | |
| | | public String getPlacementAddress() { |
| | | return placementAddress; |
| | | } |
| | | |
| | | public void setPlacementAddress(String placementAddress) { |
| | | this.placementAddress = placementAddress; |
| | | } |
| | | |
| | | public Double getStartLon() { |
| | | return startLon; |
| | | } |
| | | |
| | | public void setStartLon(Double startLon) { |
| | | this.startLon = startLon; |
| | | } |
| | | |
| | | public Double getStartLat() { |
| | | return startLat; |
| | | } |
| | | |
| | | public void setStartLat(Double startLat) { |
| | | this.startLat = startLat; |
| | | } |
| | | |
| | | public String getStartAddress() { |
| | | return startAddress; |
| | | } |
| | | |
| | | public void setStartAddress(String startAddress) { |
| | | this.startAddress = startAddress; |
| | | } |
| | | |
| | | public Double getEndLon() { |
| | | return endLon; |
| | | } |
| | | |
| | | public void setEndLon(Double endLon) { |
| | | this.endLon = endLon; |
| | | } |
| | | |
| | | public Double getEndLat() { |
| | | return endLat; |
| | | } |
| | | |
| | | public void setEndLat(Double endLat) { |
| | | this.endLat = endLat; |
| | | } |
| | | |
| | | public String getEndAddress() { |
| | | return endAddress; |
| | | } |
| | | |
| | | public void setEndAddress(String endAddress) { |
| | | this.endAddress = endAddress; |
| | | } |
| | | |
| | | public String getRecipient() { |
| | | return recipient; |
| | | } |
| | | |
| | | public void setRecipient(String recipient) { |
| | | this.recipient = recipient; |
| | | } |
| | | |
| | | public String getRecipientPhone() { |
| | | return recipientPhone; |
| | | } |
| | | |
| | | public void setRecipientPhone(String recipientPhone) { |
| | | this.recipientPhone = recipientPhone; |
| | | } |
| | | |
| | | public Double getBoardingLon() { |
| | | return boardingLon; |
| | | } |
| | | |
| | | public void setBoardingLon(Double boardingLon) { |
| | | this.boardingLon = boardingLon; |
| | | } |
| | | |
| | | public Double getBoardingLat() { |
| | | return boardingLat; |
| | | } |
| | | |
| | | public void setBoardingLat(Double boardingLat) { |
| | | this.boardingLat = boardingLat; |
| | | } |
| | | |
| | | public String getBoardingAddress() { |
| | | return boardingAddress; |
| | | } |
| | | |
| | | public void setBoardingAddress(String boardingAddress) { |
| | | this.boardingAddress = boardingAddress; |
| | | } |
| | | |
| | | public Date getBoardingTime() { |
| | | return boardingTime; |
| | | } |
| | | |
| | | public void setBoardingTime(Date boardingTime) { |
| | | this.boardingTime = boardingTime; |
| | | } |
| | | |
| | | public Double getGetoffLon() { |
| | | return getoffLon; |
| | | } |
| | | |
| | | public void setGetoffLon(Double getoffLon) { |
| | | this.getoffLon = getoffLon; |
| | | } |
| | | |
| | | public Double getGetoffLat() { |
| | | return getoffLat; |
| | | } |
| | | |
| | | public void setGetoffLat(Double getoffLat) { |
| | | this.getoffLat = getoffLat; |
| | | } |
| | | |
| | | public String getGetoffAddress() { |
| | | return getoffAddress; |
| | | } |
| | | |
| | | public void setGetoffAddress(String getoffAddress) { |
| | | this.getoffAddress = getoffAddress; |
| | | } |
| | | |
| | | public Date getGetoffTime() { |
| | | return getoffTime; |
| | | } |
| | | |
| | | public void setGetoffTime(Date getoffTime) { |
| | | this.getoffTime = getoffTime; |
| | | } |
| | | |
| | | public Double getMileage() { |
| | | return mileage; |
| | | } |
| | | |
| | | public void setMileage(Double mileage) { |
| | | this.mileage = mileage; |
| | | } |
| | | |
| | | public Integer getPayType() { |
| | | return payType; |
| | | } |
| | | |
| | | public void setPayType(Integer payType) { |
| | | this.payType = payType; |
| | | } |
| | | |
| | | public Double getOrderMoney() { |
| | | return orderMoney; |
| | | } |
| | | |
| | | public void setOrderMoney(Double orderMoney) { |
| | | this.orderMoney = orderMoney; |
| | | } |
| | | |
| | | public Double getTravelMoney() { |
| | | return travelMoney; |
| | | } |
| | | |
| | | public void setTravelMoney(Double travelMoney) { |
| | | this.travelMoney = travelMoney; |
| | | } |
| | | |
| | | public Double getTipMoney() { |
| | | return tipMoney; |
| | | } |
| | | |
| | | public void setTipMoney(Double tipMoney) { |
| | | this.tipMoney = tipMoney; |
| | | } |
| | | |
| | | public Double getRedPacketMoney() { |
| | | return redPacketMoney; |
| | | } |
| | | |
| | | public void setRedPacketMoney(Double redPacketMoney) { |
| | | this.redPacketMoney = redPacketMoney; |
| | | } |
| | | |
| | | public Double getCouponMoney() { |
| | | return couponMoney; |
| | | } |
| | | |
| | | public void setCouponMoney(Double couponMoney) { |
| | | this.couponMoney = couponMoney; |
| | | } |
| | | |
| | | public Integer getRedPacketId() { |
| | | return redPacketId; |
| | | } |
| | | |
| | | public void setRedPacketId(Integer redPacketId) { |
| | | this.redPacketId = redPacketId; |
| | | } |
| | | |
| | | public Integer getCouponId() { |
| | | return couponId; |
| | | } |
| | | |
| | | public void setCouponId(Integer couponId) { |
| | | this.couponId = couponId; |
| | | } |
| | | |
| | | public Integer getCompanyId() { |
| | | return companyId; |
| | | } |
| | | |
| | | public void setCompanyId(Integer companyId) { |
| | | this.companyId = companyId; |
| | | } |
| | | |
| | | public Double getPayMoney() { |
| | | return payMoney; |
| | | } |
| | | |
| | | public void setPayMoney(Double payMoney) { |
| | | this.payMoney = payMoney; |
| | | } |
| | | |
| | | 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 Date getTravelTime() { |
| | | return travelTime; |
| | | } |
| | | |
| | | public void setTravelTime(Date travelTime) { |
| | | this.travelTime = travelTime; |
| | | } |
| | | |
| | | public Date getSnatchOrderTime() { |
| | | return snatchOrderTime; |
| | | } |
| | | |
| | | public void setSnatchOrderTime(Date snatchOrderTime) { |
| | | this.snatchOrderTime = snatchOrderTime; |
| | | } |
| | | |
| | | public Date getSetOutTime() { |
| | | return setOutTime; |
| | | } |
| | | |
| | | public void setSetOutTime(Date setOutTime) { |
| | | this.setOutTime = setOutTime; |
| | | } |
| | | |
| | | public Date getArriveTime() { |
| | | return arriveTime; |
| | | } |
| | | |
| | | public void setArriveTime(Date arriveTime) { |
| | | this.arriveTime = arriveTime; |
| | | } |
| | | |
| | | public Date getStartServiceTime() { |
| | | return startServiceTime; |
| | | } |
| | | |
| | | public void setStartServiceTime(Date startServiceTime) { |
| | | this.startServiceTime = startServiceTime; |
| | | } |
| | | |
| | | public Date getEndServiceTime() { |
| | | return endServiceTime; |
| | | } |
| | | |
| | | public void setEndServiceTime(Date endServiceTime) { |
| | | this.endServiceTime = endServiceTime; |
| | | } |
| | | |
| | | public Integer getOrderSource() { |
| | | return orderSource; |
| | | } |
| | | |
| | | public void setOrderSource(Integer orderSource) { |
| | | this.orderSource = orderSource; |
| | | } |
| | | |
| | | |
| | | public Integer getInvoiceId() { |
| | | return invoiceId; |
| | | } |
| | | |
| | | public void setInvoiceId(Integer invoiceId) { |
| | | this.invoiceId = invoiceId; |
| | | } |
| | | |
| | | public Integer getPayManner() { |
| | | return payManner; |
| | | } |
| | | |
| | | public void setPayManner(Integer payManner) { |
| | | this.payManner = payManner; |
| | | } |
| | | |
| | | public String getTrackId() { |
| | | return trackId; |
| | | } |
| | | |
| | | public void setTrackId(String trackId) { |
| | | this.trackId = trackId; |
| | | } |
| | | |
| | | public Double getDiscount() { |
| | | return discount; |
| | | } |
| | | |
| | | public void setDiscount(Double discount) { |
| | | this.discount = discount; |
| | | } |
| | | |
| | | public Double getDiscountMoney() { |
| | | return discountMoney; |
| | | } |
| | | |
| | | public void setDiscountMoney(Double discountMoney) { |
| | | this.discountMoney = discountMoney; |
| | | } |
| | | |
| | | public Integer getActivityId() { |
| | | return activityId; |
| | | } |
| | | |
| | | public void setActivityId(Integer activityId) { |
| | | this.activityId = activityId; |
| | | } |
| | | |
| | | public Integer getIsDelete() { |
| | | return isDelete; |
| | | } |
| | | |
| | | public void setIsDelete(Integer isDelete) { |
| | | this.isDelete = isDelete; |
| | | } |
| | | |
| | | public String getTelX() { |
| | | return telX; |
| | | } |
| | | |
| | | public void setTelX(String telX) { |
| | | this.telX = telX; |
| | | } |
| | | |
| | | public String getBindId() { |
| | | return bindId; |
| | | } |
| | | |
| | | public void setBindId(String bindId) { |
| | | this.bindId = bindId; |
| | | } |
| | | |
| | | public String getPickUpCode() { |
| | | return pickUpCode; |
| | | } |
| | | |
| | | public void setPickUpCode(String pickUpCode) { |
| | | this.pickUpCode = pickUpCode; |
| | | } |
| | | |
| | | public Integer getIsReassign() { |
| | | return isReassign; |
| | | } |
| | | |
| | | public void setIsReassign(Integer isReassign) { |
| | | this.isReassign = isReassign; |
| | | } |
| | | |
| | | public Integer getReassignNotice() { |
| | | return reassignNotice; |
| | | } |
| | | |
| | | public void setReassignNotice(Integer reassignNotice) { |
| | | this.reassignNotice = reassignNotice; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "OrderLogistics{" + |
| | | "id=" + id + |
| | | ", type=" + type + |
| | | ", userId=" + userId + |
| | | ", driverId=" + driverId + |
| | | ", carId=" + carId + |
| | | ", orderNum='" + orderNum + '\'' + |
| | | ", cargoType=" + cargoType + |
| | | ", cargoNumber=" + cargoNumber + |
| | | ", remark=" + remark + |
| | | ", placementLon=" + placementLon + |
| | | ", placementLat=" + placementLat + |
| | | ", placementAddress='" + placementAddress + '\'' + |
| | | ", startLon=" + startLon + |
| | | ", startLat=" + startLat + |
| | | ", startAddress='" + startAddress + '\'' + |
| | | ", endLon=" + endLon + |
| | | ", endLat=" + endLat + |
| | | ", endAddress='" + endAddress + '\'' + |
| | | ", recipient='" + recipient + '\'' + |
| | | ", recipientPhone='" + recipientPhone + '\'' + |
| | | ", boardingLon=" + boardingLon + |
| | | ", boardingLat=" + boardingLat + |
| | | ", boardingAddress='" + boardingAddress + '\'' + |
| | | ", boardingTime=" + boardingTime + |
| | | ", getoffLon=" + getoffLon + |
| | | ", getoffLat=" + getoffLat + |
| | | ", getoffAddress='" + getoffAddress + '\'' + |
| | | ", getoffTime=" + getoffTime + |
| | | ", mileage=" + mileage + |
| | | ", payManner=" + payManner + |
| | | ", payType=" + payType + |
| | | ", orderMoney=" + orderMoney + |
| | | ", travelMoney=" + travelMoney + |
| | | ", tipMoney=" + tipMoney + |
| | | ", redPacketMoney=" + redPacketMoney + |
| | | ", couponMoney=" + couponMoney + |
| | | ", redPacketId=" + redPacketId + |
| | | ", couponId=" + couponId + |
| | | ", discount=" + discount + |
| | | ", discountMoney=" + discountMoney + |
| | | ", activityId=" + activityId + |
| | | ", companyId=" + companyId + |
| | | ", payMoney=" + payMoney + |
| | | ", state=" + state + |
| | | ", insertTime=" + insertTime + |
| | | ", travelTime=" + travelTime + |
| | | ", snatchOrderTime=" + snatchOrderTime + |
| | | ", setOutTime=" + setOutTime + |
| | | ", arriveTime=" + arriveTime + |
| | | ", startServiceTime=" + startServiceTime + |
| | | ", endServiceTime=" + endServiceTime + |
| | | ", orderSource=" + orderSource + |
| | | ", invoiceId=" + invoiceId + |
| | | ", trackId='" + trackId + '\'' + |
| | | ", isDelete=" + isDelete + |
| | | ", telX='" + telX + '\'' + |
| | | ", bindId='" + bindId + '\'' + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.smallLogistics.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 小件物流差价 |
| | | */ |
| | | @TableName("t_order_logistics_spread") |
| | | public class OrderLogisticsSpread { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 小件物流订单id |
| | | */ |
| | | @TableField("orderLogisticsId") |
| | | private Integer orderLogisticsId; |
| | | /** |
| | | * 需要支付的差价金额 |
| | | */ |
| | | @TableField("price") |
| | | private Double price; |
| | | /** |
| | | * 支付方式(1=微信,2=支付宝,3=其他) |
| | | */ |
| | | @TableField("payType") |
| | | private Integer payType; |
| | | /** |
| | | * 支付时间 |
| | | */ |
| | | @TableField("payTime") |
| | | private Date payTime; |
| | | /** |
| | | * 支付金额 |
| | | */ |
| | | @TableField("payMoney") |
| | | private Double payMoney; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getOrderLogisticsId() { |
| | | return orderLogisticsId; |
| | | } |
| | | |
| | | public void setOrderLogisticsId(Integer orderLogisticsId) { |
| | | this.orderLogisticsId = orderLogisticsId; |
| | | } |
| | | |
| | | public Double getPrice() { |
| | | return price; |
| | | } |
| | | |
| | | public void setPrice(Double price) { |
| | | this.price = price; |
| | | } |
| | | |
| | | public Integer getPayType() { |
| | | return payType; |
| | | } |
| | | |
| | | public void setPayType(Integer payType) { |
| | | this.payType = payType; |
| | | } |
| | | |
| | | public Date getPayTime() { |
| | | return payTime; |
| | | } |
| | | |
| | | public void setPayTime(Date payTime) { |
| | | this.payTime = payTime; |
| | | } |
| | | |
| | | public Double getPayMoney() { |
| | | return payMoney; |
| | | } |
| | | |
| | | public void setPayMoney(Double payMoney) { |
| | | this.payMoney = payMoney; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "OrderLogisticsSpread{" + |
| | | "id=" + id + |
| | | ", orderLogisticsId=" + orderLogisticsId + |
| | | ", price=" + price + |
| | | ", payType=" + payType + |
| | | ", payTime=" + payTime + |
| | | ", payMoney=" + payMoney + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.smallLogistics.server; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.system.model.Region; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface IOrderLogisticsService extends IService<OrderLogistics> { |
| | | |
| | | |
| | | /** |
| | | * 根据起点和终点坐标判断是不是同一个市内 |
| | | * @param startLonLat |
| | | * @param endAddress |
| | | * @return |
| | | */ |
| | | ResultUtil judgingTheCity(String startLonLat, String endAddress) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取小件物流的单价数据 |
| | | * @param type |
| | | * @param startLonLat |
| | | * @param endAddress |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil queryLogisticsUnitPrice(Integer type, String startLonLat, String endAddress, Integer uid) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取支付金额 |
| | | * @param type |
| | | * @param startLonLat |
| | | * @param endAddress |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil queryPayMoney(Integer number, Integer type, String startLonLat, String endAddress) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 小件物流下单操作 |
| | | * @param type |
| | | * @param cargoType |
| | | * @param cargoNumber |
| | | * @param remark |
| | | * @param placementLon |
| | | * @param placementLat |
| | | * @param startLon |
| | | * @param startLat |
| | | * @param startAddress |
| | | * @param recipient |
| | | * @param recipientPhone |
| | | * @param endAddress |
| | | * @param travelTime |
| | | * @param orderSource |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil smallLogistics(Integer type, Integer cargoType, Integer cargoNumber, String remark, String placementLon, String placementLat, String startLon, String startLat, String startAddress, |
| | | String recipient, String recipientPhone, String endAddress, Integer urgent, Double tipMoney, Date travelTime, Integer orderSource, Integer uid) throws Exception; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 订单完成支付订单操作 |
| | | * @param payType |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil payLogisticsOrder(Integer payType, Integer orderId, Integer type)throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 订单补差价支付操作 |
| | | * @param payType |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil payLogisticsOrder_(Integer payType, Integer orderId, Integer type)throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 支付完成后的订单处理 |
| | | * @param id 订单=id |
| | | * @param order_id 工行支付单号 |
| | | * @param type 1=微信,2=支付宝 |
| | | * @throws Exception |
| | | */ |
| | | void payOrderLogisticsCallback(Integer id, String order_id, Integer type) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 差价支付完成后的回调处理 |
| | | * @param id 订单=id |
| | | * @param order_id 工行支付单号 |
| | | * @param type 1=微信,2=支付宝 |
| | | * @throws Exception |
| | | */ |
| | | void payOrderLogisticsSpreadCallback(Integer id, String order_id, Integer type) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取首页订单数量 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | int queryLogisticsNumber(Integer uid) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取用户的订单列表 |
| | | * @param uid |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryMyOrderList(Integer uid, Integer pageNum, Integer size) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取历史消费记录 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryMyTravelRecord(Integer uid); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取用户端发票页面中的订单列表数据 |
| | | * @param type 开票状态(1=未开票,2=已开票) |
| | | * @param startTime 订单开始时间 |
| | | * @param endTime 订单结束时间 |
| | | * @param startMoney 订单金额范围 |
| | | * @param endMoney |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Map<String, Object>> queryInvoiceOrder(Integer type, Date startTime, Date endTime, Double startMoney, |
| | | Double endMoney, Integer uid, Integer orderType) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加取消 |
| | | * @param id |
| | | * @param reason |
| | | * @param remark |
| | | * @param uid |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil addCancle(Integer id, String reason, String remark, Integer uid) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取行政区域数据 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Map<String, Object> queryRegion() throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取行政区域联动数据 |
| | | * @param parentId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<Region> queryRegions(Integer parentId) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取用户余额和可用优惠券数量 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Map<String, Object> queryBalance(Integer orderId, Integer uid) throws Exception; |
| | | } |
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/IOrderLogisticsSpreadService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsSpreadService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/controller/OrderPrivateCarController.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/dao/OrderPrivateCarMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/dao/mapping/OrderPrivateCarMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/model/OrderPrivateCar.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/IOrderPrivateCarService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/auth/AuthIntercepter.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/auth/AuthService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/auth/AuthenticationKit.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/auth/Configuration.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/auth/HMACSHA1.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/auth/HashKit.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/auth/UrlEncoderUtils.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/BlackboardController.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/DeptController.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/DictController.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/KaptchaController.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/LogController.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/LoginController.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/LoginLogController.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/MenuController.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/NoticeController.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/RoleController.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/UserMgrController.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/AdvertisementMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/AgreementMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/CancleOrderMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/CarMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/CarServiceMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/CompanyCityMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/CompanyMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/ComplaintMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/DeptMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/DictMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/DriverActivityHistoryMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/DriverActivityRegisteredMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/DriverMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/DriverOrdersMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/DriverServiceMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/DriverWorkMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/ExpenseMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/FeedbackMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/FrequentPassengersMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/GDInterfaceMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/IncomeMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/IntegralGoodsMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/IntegralOrderMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/InvoiceMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/LoginLogMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/MenuMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/NoticeMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/OpenCityBusinessMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/OpenCityMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/OperationLogMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/OrderCancelMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/OrderEvaluateMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/OrderFrequentPassengersMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/OrderPositionMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/PhoneMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/ProblemMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/PushOrderMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/RedPacketRecordMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/RegionMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/RelationMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/RoleMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/SensitiveWordsMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/ServerCarModelMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/SmsrecordMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/SysCouponRecordMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/SysIntegralMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/SysReformistMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/SystemNoticeMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/SystemPriceMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/TActivityGeneralizationMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/TNoticesMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/TOpenCitySiteMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/UserActivityBalanceMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/UserActivityDiscount1Mapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/UserActivityInviteMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/UserActivityRedenvelopeMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/UserActivityRegisteredMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/UserCouponRecordMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/UserInfoMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/UserMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/UserRedPacketRecordMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/VerifiedMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/VersionManagementMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/WithdrawalMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/AdvertisementMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/AgreementMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/CancleOrderMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/CarMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/CarServiceMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/CompanyCityMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/CompanyMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/ComplaintMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DeptMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DictMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DriverActivityHistoryMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DriverActivityRegisteredMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DriverMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DriverOrdersMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DriverServiceMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DriverWorkMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/ExpenseMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/FeedbackMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/FrequentPassengersMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/GDInterfaceMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/IncomeMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/IntegralGoodsMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/IntegralOrderMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/InvoiceMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/LoginLogMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/MenuMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/NoticeMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/OpenCityBusinessMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/OpenCityMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/OperationLogMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/OrderCancelMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/OrderEvaluateMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/OrderFrequentPassengersMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/OrderPositionMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/PhoneMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/ProblemMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/PushOrderMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/RedPacketRecordMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/RegionMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/RelationMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/RoleMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/SensitiveWordsMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/ServerCarModelMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/SmsrecordMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/SysIntegralMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/SysReformistMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/SystemNoticeMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/SystemPriceMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TNoticesMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserActivityBalanceMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserActivityDiscount1Mapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserActivityInviteMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserActivityRedenvelopeMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserActivityRegisteredMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserInfoMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserRedPacketRecordMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/VerifiedMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/VersionManagementMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/WithdrawalMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/factory/UserFactory.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/kaipiao/KaiPiaoUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/kaipiao/SptBlueInvOpenDemo.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/kaipiao/email/KaiPiaoEmail.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/kaipiao/entity/ChargeInfo.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/kaipiao/entity/GlobalInfo.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/kaipiao/entity/InvoiceData.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/kaipiao/entity/InvoiceDetails.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/kaipiao/entity/MaterialInfo.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/kaipiao/entity/ReturnData.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/kaipiao/util/CreatAndSendUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/kaipiao/util/Jisuan.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Advertisement.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Agreement.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/AliSms.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/BaseBean.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/CancleOrder.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Car.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/CarService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Company.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/CompanyCity.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Complaint.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Dept.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Dict.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Driver.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/DriverActivityHistory.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/DriverActivityRegistered.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/DriverOrders.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/DriverService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/DriverWork.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Expense.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Feedback.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/FrequentPassengers.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/GDInterface.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Income.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/IntegralGoods.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/IntegralOrder.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Invoice.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/LoginLog.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Menu.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Notice.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/OpenCity.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/OpenCityBusiness.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/OperationLog.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/OrderCancel.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/OrderEvaluate.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/OrderFrequentPassengers.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/OrderPosition.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Phone.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Problem.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/PushOrder.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/RedPacketRecord.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Region.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Relation.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Role.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/SensitiveWords.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/ServerCarModel.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Smsrecord.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/SysCouponRecord.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/SysIntegral.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/SysReformist.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/SystemNotice.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/SystemPrice.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TActivityGeneralization.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TCharteredService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TNotices.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TOpenCitySite.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/User.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserActivityBalance.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserActivityDiscount1.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserActivityInvite.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserActivityRedenvelope.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserActivityRegistered.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserCouponRecord.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserInfo.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/UserRedPacketRecord.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Verified.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/VersionManagement.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/Withdrawal.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IAdvertisementService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IAgreementService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ICancleOrderService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ICompanyCityService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ICompanyService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IComplaintService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IDeptService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IDictService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IDriverOrdersService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IDriverService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IDriverServiceService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IFeedbackService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IFrequentPassengersService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IGDInterfaceService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IIncomeService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IIntegralGoodsService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IIntegralOrderService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IInvoiceService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ILoginLogService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IMenuService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/INettyService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/INoticeService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IOpenCityBusinessService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IOpenCityService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IOperationLogService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IOrderCancelService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IOrderEvaluateService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IOrderFrequentPassengersService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IOrderPositionService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IOrderService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IPhoneService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IProblemService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IPushOrderService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IRedPacketRecordService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IRelationService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IRoleService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IServerCarModelService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ISmsrecordService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ISysCouponRecordService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ISystemNoticeService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITActivityGeneralizationService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITCharteredServiceService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITNoticesService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserActivityBalanceService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserActivityRedenvelopeService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserActivityRegisteredService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserCouponRecordService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserInfoService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserRedPacketRecordService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IUserService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IVerifiedService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IVersionManagementService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/IWithdrawalService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/AdvertisementServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/AgreementServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/CancleOrderServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/CompanyCityServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/CompanyServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ComplaintServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DeptServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DictServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverOrdersServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverServiceServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/FeedbackServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/FrequentPassengersServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/GDInterfaceServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/IncomeServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/IntegralGoodsServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/IntegralOrderServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/InvoiceServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/LoginLogServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/MenuServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/NettyServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/NoticeServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OpenCityBusinessServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OpenCityServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OperationLogServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderCancelServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderEvaluateServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderFrequentPassengersServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderPositionServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/PhoneServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ProblemServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/PushOrderServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/RedPacketRecordServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/RelationServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/RoleServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ServerCarModelServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/SmsrecordServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/SysCouponRecordServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/SystemNoticeServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TActivityGeneralizationServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TCharteredServiceServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TNoticesServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserActivityBalanceServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserActivityRedenvelopeServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserActivityRegisteredServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserCouponRecordServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserRedPacketRecordServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/VerifiedServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/VersionManagementServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/WithdrawalServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/transfer/ManagerUser.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/transfer/ReqAddManager.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/transfer/ReqEditManager.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/transfer/UserDto.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/ALiApiUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/ALiSendSms.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/AmapGeocoding.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/ApplicationRunnerUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/ChinaMobileUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/DateUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GDFalconUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GDMapElectricFenceUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GDMapGeocodingUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GeodesyUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/HttpClientUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/HuaWeiSMSUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/ICBCPayUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/JuHeUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/MD5AndKL.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/MinistryOfTransport.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/ObsUploadUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/OssUploadUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PayMoneyUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushMinistryOfTransportUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/RedisUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/ResultUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/SystemException.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TaskUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/UUIDUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/UrlLinkUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/WeChatUtil.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/AdvertisementWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/BaseWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/CouponWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/DeptWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/DictWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/DriverInfoWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/EndPushWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/IntegralGoodsWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/IntegralOrderWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/InvoiceWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/LogWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/LoginWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/MenuWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/NoticeWrapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/OrderDriverWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/OrderEvaluateWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/OrderInfoWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/OrderServerWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/OrderStatusWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/OrderWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/ProblemWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/RoleWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/ServerCarModelWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/SystemNoticeWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/TNoticeWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/TravelRecordWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/UserInfoWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/UserWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/VerifiedWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/VersionWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/WithdrawalWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/controller/OrderTaxiController.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/controller/TaxiCallbackController.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/controller/TaxiDriverController.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/dao/OrderTaxiMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/dao/PaymentRecordMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/dao/TransactionDetailsMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/dao/mapping/OrderTaxiMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/dao/mapping/PaymentRecordMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/dao/mapping/TransactionDetailsMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/model/OrderTaxi.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/model/PaymentRecord.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/model/TransactionDetails.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/IOrderTaxiService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/IPaymentRecordService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/ITransactionDetailsService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/PaymentRecordServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/TransactionDetailsServiceImpl.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/warpper/OrderTaxiWarpper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/transfer/controller/OrderTransferController.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/transfer/dao/OrderTransferMapper.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/transfer/dao/mapping/OrderTransferMapper.xml
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/transfer/model/OrderTransferCar.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/transfer/model/SiteDto.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/transfer/server/IOrderTransferService.java
UserNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/transfer/server/impl/OrderTransferServiceImpl.java
UserNTTravel/guns-admin/src/main/resources/META-INF/spring-devtools.properties
UserNTTravel/guns-admin/src/main/resources/application.yml
UserNTTravel/guns-admin/src/main/resources/ehcache.xml
UserNTTravel/guns-admin/src/main/resources/logback-spring.xml
UserNTTravel/guns-admin/src/main/resources/redis.properties |