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>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> |
| | | |
| | | <dependency> |
| | | <groupId>redis.clients</groupId> |
| | | <artifactId>jedis</artifactId> |
| | | <version>2.9.0</version> |
| | | </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>cn.jpush.api</groupId> |
| | | <artifactId>jpush-client</artifactId> |
| | | <version>3.3.10</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> |
| | | <!-- obs对象存储 --> |
| | | <dependency> |
| | | <groupId>com.huaweicloud</groupId> |
| | | <artifactId>esdk-obs-java-bundle</artifactId> |
| | | <version>[3.21.11,)</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> |
| | | <version>1.18.20</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>commons-codec</groupId> |
| | | <artifactId>commons-codec</artifactId> |
| | | <version>1.13</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-mongodb</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
| | | <version>5.7.7</version> |
| | | </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.agentdriving.user; |
| | | |
| | | 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.mybatis.spring.annotation.MapperScan; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | 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//启动事务功能 |
| | | @MapperScan("com.agentdriving.user.modular.system.dao") |
| | | public class GunsApplication { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(GunsApplication.class); |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(GunsApplication.class, args); |
| | | logger.info("GunsApplication is success!"); |
| | | } |
| | | |
| | | |
| | | @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; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 向Spring容器中定义RestTemplate对象 |
| | | * @return |
| | | */ |
| | | @Bean //必须new 一个RestTemplate并放入spring容器当中,否则启动时报错 |
| | | 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; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user; |
| | | |
| | | 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.agentdriving.user.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.agentdriving.user.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.agentdriving.user.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.agentdriving.user.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.agentdriving.user.modular.system.controller")) //这里采用包扫描的方式来确定要显示的接口 |
| | | .paths(PathSelectors.any()) |
| | | .build(); |
| | | } |
| | | |
| | | private ApiInfo apiInfo() { |
| | | return new ApiInfoBuilder() |
| | | .title("超省新代驾") |
| | | .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.agentdriving.user.config.datasource; |
| | | |
| | | import com.agentdriving.user.core.mutidatasource.aop.MultiSourceExAop; |
| | | import com.alibaba.druid.pool.DruidDataSource; |
| | | import com.baomidou.mybatisplus.plugins.OptimisticLockerInterceptor; |
| | | import com.baomidou.mybatisplus.plugins.PaginationInterceptor; |
| | | import com.agentdriving.user.core.config.properties.DruidProperties; |
| | | import com.agentdriving.user.core.config.properties.MutiDataSourceProperties; |
| | | import com.agentdriving.user.core.datascope.DataScopeInterceptor; |
| | | import com.agentdriving.user.core.mutidatasource.DynamicDataSource; |
| | | 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.agentdriving.user.modular.*.dao","com.agentdriving.user.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.agentdriving.user.config.datasource; |
| | | |
| | | import com.alibaba.druid.pool.DruidDataSource; |
| | | import com.baomidou.mybatisplus.plugins.OptimisticLockerInterceptor; |
| | | import com.baomidou.mybatisplus.plugins.PaginationInterceptor; |
| | | import com.agentdriving.user.core.config.properties.DruidProperties; |
| | | import com.agentdriving.user.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.agentdriving.user.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.agentdriving.user.config.properties; |
| | | |
| | | import com.agentdriving.user.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.agentdriving.user.config.properties; |
| | | |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.File; |
| | | |
| | | /** |
| | | * 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 (ToolUtil.isEmpty(fileUploadPath)) { |
| | | return ToolUtil.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.agentdriving.user.config.web; |
| | | |
| | | import com.agentdriving.user.config.properties.BeetlProperties; |
| | | import com.agentdriving.user.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.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.agentdriving.user.config.web; |
| | | |
| | | import com.agentdriving.user.config.properties.GunsProperties; |
| | | import com.agentdriving.user.core.intercept.GunsUserFilter; |
| | | import com.agentdriving.user.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/**", "anon"); |
| | | 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.agentdriving.user.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.agentdriving.user.config.properties.GunsProperties; |
| | | import com.agentdriving.user.core.intercept.RestApiInteceptor; |
| | | import com.agentdriving.user.core.listener.ConfigListener; |
| | | import com.agentdriving.user.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.agentdriving.user.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.agentdriving.user.core.aop; |
| | | |
| | | import com.agentdriving.user.core.base.tips.ErrorTip; |
| | | import com.agentdriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.agentdriving.user.core.common.exception.InvalidKaptchaException; |
| | | import com.agentdriving.user.core.exception.GunsException; |
| | | import com.agentdriving.user.core.log.LogManager; |
| | | import com.agentdriving.user.core.log.factory.LogTaskFactory; |
| | | import com.agentdriving.user.core.shiro.ShiroKit; |
| | | import com.agentdriving.user.core.support.HttpKit; |
| | | 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; |
| | | |
| | | /** |
| | | * 全局的的异常拦截器(拦截所有的控制器)(带有@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)); |
| | | HttpKit.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 = HttpKit.getRequest().getParameter("username"); |
| | | LogManager.me().executeLog(LogTaskFactory.loginLog(username, "账号被冻结", HttpKit.getIp())); |
| | | model.addAttribute("tips", "账号被冻结"); |
| | | return "/login.html"; |
| | | } |
| | | |
| | | /** |
| | | * 账号密码错误异常 |
| | | */ |
| | | @ExceptionHandler(CredentialsException.class) |
| | | @ResponseStatus(HttpStatus.UNAUTHORIZED) |
| | | public String credentials(CredentialsException e, Model model) { |
| | | String username = HttpKit.getRequest().getParameter("username"); |
| | | LogManager.me().executeLog(LogTaskFactory.loginLog(username, "账号密码错误", HttpKit.getIp())); |
| | | model.addAttribute("tips", "账号密码错误"); |
| | | return "/login.html"; |
| | | } |
| | | |
| | | /** |
| | | * 验证码错误异常 |
| | | */ |
| | | @ExceptionHandler(InvalidKaptchaException.class) |
| | | @ResponseStatus(HttpStatus.BAD_REQUEST) |
| | | public String credentials(InvalidKaptchaException e, Model model) { |
| | | String username = HttpKit.getRequest().getParameter("username"); |
| | | LogManager.me().executeLog(LogTaskFactory.loginLog(username, "验证码错误", HttpKit.getIp())); |
| | | model.addAttribute("tips", "验证码错误"); |
| | | return "/login.html"; |
| | | } |
| | | |
| | | /** |
| | | * 无权访问该资源异常 |
| | | */ |
| | | @ExceptionHandler(UndeclaredThrowableException.class) |
| | | @ResponseStatus(HttpStatus.UNAUTHORIZED) |
| | | @ResponseBody |
| | | public ErrorTip credentials(UndeclaredThrowableException e) { |
| | | HttpKit.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)); |
| | | HttpKit.getRequest().setAttribute("tip", "服务器未知运行时异常"); |
| | | log.error("运行时异常:", e); |
| | | return new ErrorTip(BizExceptionEnum.SERVER_ERROR.getCode(), BizExceptionEnum.SERVER_ERROR.getMessage()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.core.aop; |
| | | |
| | | import com.agentdriving.user.core.common.annotion.BussinessLog; |
| | | import com.agentdriving.user.core.common.constant.dictmap.base.AbstractDictMap; |
| | | import com.agentdriving.user.core.log.LogManager; |
| | | import com.agentdriving.user.core.log.LogObjectHolder; |
| | | import com.agentdriving.user.core.log.factory.LogTaskFactory; |
| | | import com.agentdriving.user.core.shiro.ShiroKit; |
| | | import com.agentdriving.user.core.shiro.ShiroUser; |
| | | import com.agentdriving.user.core.support.HttpKit; |
| | | import com.agentdriving.user.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.agentdriving.user.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.agentdriving.user.core.aop; |
| | | |
| | | import com.agentdriving.user.core.common.annotion.Permission; |
| | | import com.agentdriving.user.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.agentdriving.user.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.agentdriving.user.core.beetl; |
| | | |
| | | import com.agentdriving.user.core.tag.DictSelectorTag; |
| | | import com.agentdriving.user.core.util.KaptchaUtil; |
| | | import com.agentdriving.user.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.agentdriving.user.core.beetl; |
| | | |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.subject.Subject; |
| | | import org.beetl.core.GroupTemplate; |
| | | |
| | | import com.agentdriving.user.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.agentdriving.user.core.common.annotion; |
| | | |
| | | import com.agentdriving.user.core.common.constant.dictmap.base.AbstractDictMap; |
| | | import com.agentdriving.user.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.agentdriving.user.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.agentdriving.user.core.common.annotion; |
| | | |
| | | import java.lang.annotation.*; |
| | | |
| | | /** |
| | | * 接口日志注解 |
| | | */ |
| | | @Inherited |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Target({ElementType.METHOD}) |
| | | public @interface ServiceLog { |
| | | /** |
| | | * 接口名称 |
| | | * @return |
| | | */ |
| | | String name() default ""; |
| | | |
| | | /** |
| | | * 接口地址 |
| | | * @return |
| | | */ |
| | | String url() default ""; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.core.common.aspect; |
| | | |
| | | import com.agentdriving.user.core.common.annotion.ServiceLog; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | 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.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.lang.reflect.Method; |
| | | import java.lang.reflect.Parameter; |
| | | |
| | | @Aspect |
| | | @Component |
| | | public class ServiceLogAspect { |
| | | |
| | | Logger logger = LoggerFactory.getLogger("ServiceLog"); |
| | | |
| | | /** |
| | | * //切面点为标记了@ServiceLog注解的方法 |
| | | */ |
| | | @Pointcut("@annotation(com.agentdriving.user.core.common.annotion.ServiceLog)") |
| | | public void serviceLog(){ |
| | | } |
| | | |
| | | |
| | | //环绕通知 |
| | | @Around("serviceLog()") |
| | | @SuppressWarnings("unchecked") |
| | | public Object around(ProceedingJoinPoint joinPoint) throws Throwable { |
| | | try { |
| | | long starTime = System.currentTimeMillis(); |
| | | //通过反射获取被调用方法的Class |
| | | Class type = joinPoint.getSignature().getDeclaringType(); |
| | | //获取类名 |
| | | String typeName = type.getSimpleName(); |
| | | //方法名 |
| | | String methodName = joinPoint.getSignature().getName(); |
| | | //获取参数列表 |
| | | Object[] args = joinPoint.getArgs(); |
| | | //参数Class的数组 |
| | | Class[] clazz = new Class[args.length]; |
| | | for (int i = 0; i < args.length; i++) { |
| | | clazz[i] = args[i].getClass(); |
| | | } |
| | | //通过反射获取调用的方法method |
| | | Method method = type.getMethod(methodName, clazz); |
| | | ServiceLog serviceLog = method.getAnnotation(ServiceLog.class); |
| | | //获取方法的参数 |
| | | Parameter[] parameters = method.getParameters(); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | for (int i = 0; i < parameters.length; i++) { |
| | | Parameter parameter = parameters[i]; |
| | | String name = parameter.getName(); |
| | | jsonObject.put(name, args[i]); |
| | | } |
| | | //执行结果 |
| | | //执行目标方法,获取执行结果 |
| | | Object res = joinPoint.proceed(); |
| | | logger.debug("调用{}.{}方法成功\n" + |
| | | "接口名称:{}\n" + |
| | | "接口地址:{}\n" + |
| | | "耗时:{}ms\n" + |
| | | "参数为:{}\n" + |
| | | "返回结果:{}", typeName, methodName, serviceLog.name(), serviceLog.url(), |
| | | (System.currentTimeMillis() - starTime), jsonObject.toJSONString(), JSONObject.toJSONString(res)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return joinPoint.proceed(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.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.agentdriving.user.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.agentdriving.user.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.agentdriving.user.core.common.constant.cache; |
| | | |
| | | /** |
| | | * 所有缓存名称的集合 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-04-24 21:56 |
| | | */ |
| | | public interface Cache { |
| | | |
| | | /** |
| | | * 常量缓存 |
| | | */ |
| | | String CONSTANT = "CONSTANT"; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.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.agentdriving.user.core.common.constant.dictmap; |
| | | |
| | | import com.agentdriving.user.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.agentdriving.user.core.common.constant.dictmap; |
| | | |
| | | import com.agentdriving.user.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.agentdriving.user.core.common.constant.dictmap; |
| | | |
| | | import com.agentdriving.user.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.agentdriving.user.core.common.constant.dictmap; |
| | | |
| | | import com.agentdriving.user.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.agentdriving.user.core.common.constant.dictmap; |
| | | |
| | | import com.agentdriving.user.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.agentdriving.user.core.common.constant.dictmap; |
| | | |
| | | import com.agentdriving.user.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.agentdriving.user.core.common.constant.dictmap; |
| | | |
| | | import com.agentdriving.user.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.agentdriving.user.core.common.constant.dictmap; |
| | | |
| | | import com.agentdriving.user.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.agentdriving.user.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.agentdriving.user.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.agentdriving.user.core.common.constant.dictmap.factory; |
| | | |
| | | import com.agentdriving.user.core.exception.GunsException; |
| | | import com.agentdriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.agentdriving.user.core.common.constant.factory.IConstantFactory; |
| | | import com.agentdriving.user.core.common.exception.BizExceptionEnum; |
| | | |
| | | 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.agentdriving.user.core.common.constant.factory; |
| | | |
| | | import com.agentdriving.user.core.util.Convert; |
| | | import com.agentdriving.user.modular.system.dao.*; |
| | | import com.agentdriving.user.modular.system.model.*; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.agentdriving.user.core.common.constant.cache.Cache; |
| | | import com.agentdriving.user.core.common.constant.cache.CacheKey; |
| | | import com.agentdriving.user.core.common.constant.state.ManagerStatus; |
| | | import com.agentdriving.user.core.common.constant.state.MenuStatus; |
| | | import com.agentdriving.user.modular.system.model.*; |
| | | import com.agentdriving.user.core.log.LogObjectHolder; |
| | | import com.agentdriving.user.core.support.StrKit; |
| | | import com.agentdriving.user.core.util.SpringContextHolder; |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.agentdriving.user.modular.system.dao.*; |
| | | 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.agentdriving.user.core.common.constant.factory; |
| | | |
| | | import com.agentdriving.user.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.agentdriving.user.core.common.constant.factory; |
| | | |
| | | import com.agentdriving.user.core.support.StrKit; |
| | | import com.agentdriving.user.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.agentdriving.user.core.common.constant.factory; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.agentdriving.user.core.common.constant.state.Order; |
| | | import com.agentdriving.user.core.support.HttpKit; |
| | | import com.agentdriving.user.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.agentdriving.user.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.agentdriving.user.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.agentdriving.user.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.agentdriving.user.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.agentdriving.user.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.agentdriving.user.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.agentdriving.user.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.agentdriving.user.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.agentdriving.user.core.common.exception; |
| | | |
| | | import com.agentdriving.user.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(10030, "token过期"), |
| | | TOKEN_ERROR(10030, "token验证失败"), |
| | | |
| | | /** |
| | | * 签名异常 |
| | | */ |
| | | SIGN_ERROR(10040, "签名验证失败"), |
| | | |
| | | /** |
| | | * 其他 |
| | | */ |
| | | 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.agentdriving.user.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.agentdriving.user.core.intercept; |
| | | |
| | | import com.agentdriving.user.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.agentdriving.user.core.intercept; |
| | | |
| | | import com.agentdriving.user.core.base.tips.ErrorTip; |
| | | import com.agentdriving.user.core.common.constant.JwtConstants; |
| | | import com.agentdriving.user.core.util.JwtTokenUtil; |
| | | import com.agentdriving.user.core.util.RenderUtil; |
| | | import com.agentdriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.agentdriving.user.modular.system.util.ResultUtil; |
| | | import com.agentdriving.user.modular.system.warpper.ResponseWarpper; |
| | | 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())); |
| | | RenderUtil.renderJson(response, ResponseWarpper.success(ResultUtil.tokenErr())); |
| | | return false; |
| | | } |
| | | } else { |
| | | //header没有带Bearer字段 |
| | | // RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_ERROR.getCode(), BizExceptionEnum.TOKEN_ERROR.getMessage())); |
| | | RenderUtil.renderJson(response, ResponseWarpper.success(ResultUtil.tokenErr())); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.core.intercept; |
| | | |
| | | import com.agentdriving.user.core.base.controller.BaseController; |
| | | import com.agentdriving.user.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.agentdriving.user.*..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.agentdriving.user.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.agentdriving.user.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.agentdriving.user.core.log; |
| | | |
| | | import com.agentdriving.user.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.agentdriving.user.core.log.factory; |
| | | |
| | | import com.agentdriving.user.core.common.constant.state.LogSucceed; |
| | | import com.agentdriving.user.core.common.constant.state.LogType; |
| | | import com.agentdriving.user.modular.system.model.LoginLog; |
| | | import com.agentdriving.user.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.agentdriving.user.core.log.factory; |
| | | |
| | | import com.agentdriving.user.core.common.constant.state.LogSucceed; |
| | | import com.agentdriving.user.core.common.constant.state.LogType; |
| | | import com.agentdriving.user.core.db.Db; |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.agentdriving.user.modular.system.dao.LoginLogMapper; |
| | | import com.agentdriving.user.modular.system.dao.OperationLogMapper; |
| | | import com.agentdriving.user.modular.system.model.LoginLog; |
| | | import com.agentdriving.user.modular.system.model.OperationLog; |
| | | import com.agentdriving.user.core.log.LogManager; |
| | | 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.agentdriving.user.core.shiro; |
| | | |
| | | import com.agentdriving.user.core.shiro.factory.IShiro; |
| | | import com.agentdriving.user.core.shiro.factory.ShiroFactroy; |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.agentdriving.user.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.agentdriving.user.core.shiro; |
| | | |
| | | import com.agentdriving.user.core.common.constant.Const; |
| | | import com.agentdriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.agentdriving.user.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.agentdriving.user.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.agentdriving.user.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.agentdriving.user.core.shiro.check; |
| | | |
| | | import com.agentdriving.user.core.support.CollectionKit; |
| | | import com.agentdriving.user.core.support.HttpKit; |
| | | import com.agentdriving.user.core.util.SpringContextHolder; |
| | | import com.agentdriving.user.core.listener.ConfigListener; |
| | | import com.agentdriving.user.core.shiro.ShiroKit; |
| | | import com.agentdriving.user.core.shiro.ShiroUser; |
| | | 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.agentdriving.user.core.shiro.check; |
| | | |
| | | import com.agentdriving.user.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.agentdriving.user.core.shiro.factory; |
| | | |
| | | import com.agentdriving.user.core.shiro.ShiroUser; |
| | | import com.agentdriving.user.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.agentdriving.user.core.shiro.factory; |
| | | |
| | | import com.agentdriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.agentdriving.user.core.common.constant.state.ManagerStatus; |
| | | import com.agentdriving.user.core.shiro.ShiroUser; |
| | | import com.agentdriving.user.core.util.Convert; |
| | | import com.agentdriving.user.core.util.SpringContextHolder; |
| | | import com.agentdriving.user.modular.system.dao.MenuMapper; |
| | | import com.agentdriving.user.modular.system.dao.UserMapper; |
| | | import com.agentdriving.user.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.agentdriving.user.core.tag; |
| | | |
| | | import com.agentdriving.user.core.exception.GunsException; |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.agentdriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.agentdriving.user.modular.system.model.Dict; |
| | | import com.agentdriving.user.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.agentdriving.user.core.util; |
| | | |
| | | import com.agentdriving.user.config.properties.GunsProperties; |
| | | import com.agentdriving.user.core.common.constant.Const; |
| | | import com.agentdriving.user.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.agentdriving.user.core.util; |
| | | |
| | | import com.agentdriving.user.core.common.constant.dictmap.base.AbstractDictMap; |
| | | import com.agentdriving.user.core.common.constant.dictmap.factory.DictFieldWarpperFactory; |
| | | import com.agentdriving.user.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.agentdriving.user.core.util; |
| | | |
| | | import com.agentdriving.user.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.agentdriving.user.core.util; |
| | | |
| | | import com.agentdriving.user.config.properties.GunsProperties; |
| | | |
| | | /** |
| | | * 验证码工具类 |
| | | */ |
| | | public class KaptchaUtil { |
| | | |
| | | /** |
| | | * 获取验证码开关 |
| | | */ |
| | | public static Boolean getKaptchaOnOff() { |
| | | return SpringContextHolder.getBean(GunsProperties.class).getKaptchaOpen(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.api; |
| | | |
| | | import com.agentdriving.user.core.base.controller.BaseController; |
| | | import com.agentdriving.user.core.base.tips.ErrorTip; |
| | | import com.agentdriving.user.core.shiro.ShiroKit; |
| | | import com.agentdriving.user.core.shiro.ShiroUser; |
| | | import com.agentdriving.user.core.util.JwtTokenUtil; |
| | | import com.agentdriving.user.modular.system.dao.UserMapper; |
| | | import com.agentdriving.user.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.agentdriving.user.modular.api; |
| | | |
| | | import com.agentdriving.user.core.common.annotion.ServiceLog; |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.agentdriving.user.modular.system.service.*; |
| | | import com.agentdriving.user.modular.system.warpper.*; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.agentdriving.user.modular.system.model.AppUser; |
| | | import com.agentdriving.user.modular.system.model.SystemConfig; |
| | | import com.agentdriving.user.modular.system.service.*; |
| | | import com.agentdriving.user.modular.system.util.MallBook.model.InterfaceResponse; |
| | | import com.agentdriving.user.modular.system.util.MallBook.util.RSASignature; |
| | | import com.agentdriving.user.modular.system.util.PayMoneyUtil; |
| | | import com.agentdriving.user.modular.system.util.RedisUtil; |
| | | import com.agentdriving.user.modular.system.util.ResultUtil; |
| | | import com.agentdriving.user.modular.system.util.UUIDUtil; |
| | | import com.agentdriving.user.modular.system.util.huawei.OBSUtil; |
| | | import com.agentdriving.user.modular.system.util.huawei.SMSUtil; |
| | | import com.agentdriving.user.modular.system.warpper.*; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | 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 org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.InputStream; |
| | | import java.io.PrintWriter; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 用户控制器 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class AppUserController { |
| | | |
| | | @Autowired |
| | | private IAppUserService appUserService; |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Autowired |
| | | private ISystemConfigService systemConfigService; |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Autowired |
| | | private IUserToCouponService userToCouponService; |
| | | |
| | | @Autowired |
| | | private IAccountChangeDetailService accountChangeDetailService; |
| | | |
| | | @Autowired |
| | | private IComplaintService complaintService; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/appUserLogin") |
| | | // @ServiceLog(name = "微信登录", url = "/base/appUser/appUserLogin") |
| | | @ApiOperation(value = "微信登录", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "微信jscode", name = "jscode", required = true, dataType = "string"), |
| | | }) |
| | | public ResponseWarpper appUserLogin(String jscode){ |
| | | if(ToolUtil.isEmpty(jscode)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("jscode")); |
| | | } |
| | | try { |
| | | ResultUtil resultUtil = appUserService.appUserLogin(jscode); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/signInToRegister") |
| | | // @ServiceLog(name = "微信手机授权登录", url = "/base/appUser/signInToRegister") |
| | | @ApiOperation(value = "微信手机授权登录", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResponseWarpper<SignInToRegisterWarpper> signInToRegister(SignInToRegister signInToRegister){ |
| | | try { |
| | | ResultUtil<SignInToRegisterWarpper> resultUtil = appUserService.signInToRegister(signInToRegister); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/queryNearbyDrivers") |
| | | @ServiceLog(name = "获取附近的司机", url = "/base/appUser/queryNearbyDrivers") |
| | | @ApiOperation(value = "获取附近的司机", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "经度", name = "lon", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "纬度", name = "lat", required = true, dataType = "string"), |
| | | }) |
| | | public ResponseWarpper<List<NearbyDriverWarpper>> queryNearbyDrivers(String lon, String lat){ |
| | | if(ToolUtil.isEmpty(lat)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("lat")); |
| | | } |
| | | if(ToolUtil.isEmpty(lon)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("lon")); |
| | | } |
| | | try { |
| | | List<NearbyDriverWarpper> list = driverService.queryDriverPosition(lon, lat, 5D); |
| | | return ResponseWarpper.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/setEmergencyContact") |
| | | // @ServiceLog(name = "设置紧急联系人", url = "/base/appUser/queryNearbyDrivers") |
| | | @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 = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper setEmergencyContact(String name, String phone){ |
| | | if(ToolUtil.isEmpty(name)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("name")); |
| | | } |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("phone")); |
| | | } |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | appUser.setEmergencyContact(name); |
| | | appUser.setEmergencyPhone(phone); |
| | | appUserService.updateById(appUser); |
| | | return ResponseWarpper.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/appUser/queryUserInfo") |
| | | // @ServiceLog(name = "获取个人信息", url = "/api/appUser/queryUserInfo") |
| | | @ApiOperation(value = "获取个人信息", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<UserInfoWarpper> queryUserInfo(){ |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | UserInfoWarpper userInfoWarpper = new UserInfoWarpper(); |
| | | BeanUtils.copyProperties(appUser, userInfoWarpper); |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 7)); |
| | | if(null != systemConfig){ |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | userInfoWarpper.setServiceCell(jsonObject.getString("num1")); |
| | | } |
| | | return ResponseWarpper.success(userInfoWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/appUser/uploadImg") |
| | | // @ServiceLog(name = "上传头像图片", url = "/api/appUser/uploadImg") |
| | | @ApiOperation(value = "上传头像图片", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "图片文件", name = "file", required = true, dataType = "file"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<String> uploadImg(MultipartFile file){ |
| | | try { |
| | | InputStream inputStream = file.getInputStream(); |
| | | String name = file.getOriginalFilename(); |
| | | name = UUIDUtil.getRandomCode() + name.substring(name.lastIndexOf(".")); |
| | | String s = OBSUtil.putObjectToBucket(inputStream, name); |
| | | return ResponseWarpper.success(s); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/appUser/updateUserInfo") |
| | | // @ServiceLog(name = "修改个人信息", url = "/api/appUser/updateUserInfo") |
| | | @ApiOperation(value = "修改个人信息", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper updateUserInfo(UserInfo userInfo){ |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil resultUtil = appUserService.updateUserInfo(uid, userInfo); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/appUser/queryPriceRules") |
| | | // @ServiceLog(name = "获取价格表", url = "/api/appUser/queryPriceRules") |
| | | @ApiOperation(value = "获取价格表", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<PriceRulesWarpper> queryPriceRules(){ |
| | | try { |
| | | PriceRulesWarpper priceRulesWarpper = systemConfigService.queryPriceRules(); |
| | | return ResponseWarpper.success(priceRulesWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/appUser/queryTopUpPrompt") |
| | | // @ServiceLog(name = "获取充值优惠提示", url = "/api/appUser/queryTopUpPrompt") |
| | | @ApiOperation(value = "获取充值优惠提示", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<String> queryTopUpPrompt(){ |
| | | try { |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 6)); |
| | | if(null != systemConfig){ |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | return ResponseWarpper.success("充值满" + jsonObject.getDouble("num2") + "元,下单享9折优惠!"); |
| | | } |
| | | return ResponseWarpper.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/appUser/rechargeBalance") |
| | | // @ServiceLog(name = "充值操作", url = "/api/appUser/rechargeBalance") |
| | | @ApiOperation(value = "充值操作", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "充值金额", name = "amount", required = true, dataType = "double"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper rechargeBalance(Double amount){ |
| | | if(null == amount){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("amount")); |
| | | } |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil resultUtil = appUserService.rechargeBalance(uid, amount); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/rechargeBalanceCallback") |
| | | // @ServiceLog(name = "余额充值回调", url = "/base/appUser/rechargeBalanceCallback") |
| | | public void rechargeBalanceCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | String code = request.getParameter("code"); |
| | | String version = request.getParameter("version"); |
| | | String msg = request.getParameter("msg"); |
| | | String date = request.getParameter("date"); |
| | | String result = request.getParameter("result"); |
| | | String sign = request.getParameter("sign"); |
| | | InterfaceResponse interfaceResponse = new InterfaceResponse(); |
| | | interfaceResponse.setCode(code); |
| | | interfaceResponse.setVersion(version); |
| | | interfaceResponse.setMsg(msg); |
| | | interfaceResponse.setDate(date); |
| | | interfaceResponse.setResult(result); |
| | | interfaceResponse.setSign(sign); |
| | | // 验签 |
| | | boolean verify = RSASignature.validate(interfaceResponse.content(), interfaceResponse.getSign()); |
| | | if (verify) {//验签成功业务处理逻辑 |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | String orderId = jsonObject.getString("parameter1"); |
| | | appUserService.rechargeBalanceCallback(orderId, merOrderId); |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("OK"); |
| | | out.flush(); |
| | | out.close(); |
| | | } else {//验签失败业务处理逻辑 |
| | | System.err.println("支付回调验签失败"); |
| | | } |
| | | |
| | | // Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | // if(null != map){ |
| | | // String out_trade_no = map.get("out_trade_no"); |
| | | // String transaction_id = map.get("transaction_id"); |
| | | // String result = map.get("result"); |
| | | // String orderId = out_trade_no.substring(17); |
| | | // appUserService.rechargeBalanceCallback(out_trade_no, transaction_id); |
| | | // PrintWriter out = response.getWriter(); |
| | | // out.print(result); |
| | | // out.flush(); |
| | | // out.close(); |
| | | // } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/appUser/queryMyCoupons") |
| | | // @ServiceLog(name = "获取优惠券列表", url = "/api/appUser/queryMyCoupons") |
| | | @ApiOperation(value = "获取优惠券列表", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "状态(1=未使用,2=已使用,3=已过期)", name = "state", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "pageSize", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<List<CouponsWarpper>> queryMyCoupons(Integer state, Integer pageNum, Integer pageSize){ |
| | | if(null == state){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("state")); |
| | | } |
| | | if(null == pageNum){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); |
| | | } |
| | | if(null == pageSize){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageSize")); |
| | | } |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | List<CouponsWarpper> couponsWarppers = userToCouponService.queryMyCoupons(uid, state, pageNum, pageSize); |
| | | return ResponseWarpper.success(couponsWarppers); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/appUser/queryUsedCouponNum") |
| | | // @ServiceLog(name = "获取已使用优惠券数量", url = "/api/appUser/queryUsedCouponNum") |
| | | @ApiOperation(value = "获取已使用优惠券数量", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<Integer> queryUsedCouponNum(){ |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | Integer integer = userToCouponService.queryUsedCouponNum(uid); |
| | | return ResponseWarpper.success(integer); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/appUser/queryBalanceDetails") |
| | | // @ServiceLog(name = "获取余额明细", url = "/api/appUser/queryBalanceDetails") |
| | | @ApiOperation(value = "获取余额明细", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "统计时间", name = "time", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "pageSize", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<List<BalanceDetailsWarpper>> queryBalanceDetails(String time, Integer pageNum, Integer pageSize){ |
| | | if(ToolUtil.isEmpty(time)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("time")); |
| | | } |
| | | if(null == pageNum){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); |
| | | } |
| | | if(null == pageSize){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageSize")); |
| | | } |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | List<BalanceDetailsWarpper> balanceDetailsWarppers = accountChangeDetailService.queryBalanceDetails(uid, time, pageNum, pageSize); |
| | | return ResponseWarpper.success(balanceDetailsWarppers); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/appUser/cancelAccount") |
| | | // @ServiceLog(name = "注销账号", url = "/api/appUser/cancelAccount") |
| | | @ApiOperation(value = "注销账号", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper cancelAccount(){ |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | appUser.setStatus(3); |
| | | appUserService.updateById(appUser); |
| | | return ResponseWarpper.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/appUser/feedback") |
| | | // @ServiceLog(name = "投诉反馈", url = "/api/appUser/feedback") |
| | | @ApiOperation(value = "投诉反馈", tags = {"用户端-首页", "用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = false, dataType = "int"), |
| | | @ApiImplicitParam(value = "反馈内容", name = "content", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper feedback(Integer orderId, String content){ |
| | | if(null == content){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("content")); |
| | | } |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | complaintService.feedback(uid, orderId, content); |
| | | return ResponseWarpper.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/getVerificationCode") |
| | | // @ServiceLog(name = "获取短信验证码", url = "/base/appUser/getVerificationCode") |
| | | @ApiOperation(value = "获取短信验证码", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "国家代码+86", name = "receiver", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "电话号码", name = "phone", required = true, dataType = "string"), |
| | | }) |
| | | public ResponseWarpper getVerificationCode(String receiver, String phone){ |
| | | if(ToolUtil.isEmpty(receiver)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("receiver")); |
| | | } |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("phone")); |
| | | } |
| | | try { |
| | | String numberRandom = UUIDUtil.getNumberRandom(5); |
| | | SMSUtil.send(phone, "1d0f0cbe5b214b0d8efa891730eb532a", "[\"" + numberRandom + "\"]"); |
| | | redisUtil.setStrValue(receiver + phone, numberRandom, 300);//5分钟有效期 |
| | | return ResponseWarpper.success(ResultUtil.success()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/verifySMSCode") |
| | | // @ServiceLog(name = "验证短信验证码", url = "/base/appUser/verifySMSCode") |
| | | @ApiOperation(value = "验证短信验证码", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "电话号码", name = "phone", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "验证码", name = "code", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper verifySMSCode(String phone, String code){ |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("phone")); |
| | | } |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("code")); |
| | | } |
| | | try { |
| | | ResultUtil resultUtil = ResultUtil.success(); |
| | | phone = phone.indexOf("+86") < 0 ? "+86" + phone : phone; |
| | | String value = redisUtil.getValue(phone); |
| | | if(ToolUtil.isEmpty(value) || !value.equals(code)){ |
| | | return ResponseWarpper.success(ResultUtil.error("验证码无效")); |
| | | } |
| | | redisUtil.remove(phone); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.api; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.agentdriving.user.modular.system.model.Broadcast; |
| | | import com.agentdriving.user.modular.system.service.IBroadcastService; |
| | | import com.agentdriving.user.modular.system.warpper.ResponseWarpper; |
| | | 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.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 广播 |
| | | * @author pzb |
| | | * @Date 2023/2/27 17:12 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class BroadcastController { |
| | | |
| | | @Autowired |
| | | private IBroadcastService broadcastService; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/broadcast/queryBroadcast") |
| | | // @ServiceLog(name = "获取广播", url = "/base/broadcast/queryBroadcast") |
| | | @ApiOperation(value = "获取广播", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResponseWarpper<List<String>> queryBroadcast(){ |
| | | try { |
| | | List<Broadcast> broadcasts = broadcastService.selectList(new EntityWrapper<Broadcast>() |
| | | .eq("`status`", 1).eq("`show`", 1) |
| | | .eq("`upDown`", 1).orderBy("`sort` desc limit 0, 5")); |
| | | List<String> list = new ArrayList<>(); |
| | | for (Broadcast broadcast : broadcasts) { |
| | | list.add(broadcast.getContent()); |
| | | } |
| | | return ResponseWarpper.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.api; |
| | | |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.agentdriving.user.modular.system.service.IAppUserService; |
| | | import com.agentdriving.user.modular.system.service.ICommercialService; |
| | | import com.agentdriving.user.modular.system.util.ResultUtil; |
| | | import com.agentdriving.user.modular.system.warpper.CommercialWarpper; |
| | | import com.agentdriving.user.modular.system.warpper.ResponseWarpper; |
| | | 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; |
| | | |
| | | /** |
| | | * 广告控制器 |
| | | */ |
| | | @RestController |
| | | @RequestMapping() |
| | | public class CommercialController { |
| | | |
| | | @Autowired |
| | | private ICommercialService commercialService; |
| | | |
| | | @Autowired |
| | | private IAppUserService appUserService; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/commercial/queryCommercialList") |
| | | // @ServiceLog(name = "获取广告列表", url = "/api/driver/queryCommercialList") |
| | | @ApiOperation(value = "获取广告列表", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "广告类型(1=弹窗广告,2=底部广告)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "设备类型(1=小程序,2=司机端)", name = "device", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<List<CommercialWarpper>> queryCommercialList(Integer type, Integer device){ |
| | | if(ToolUtil.isEmpty(type)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("type")); |
| | | } |
| | | if(ToolUtil.isEmpty(device)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("device")); |
| | | } |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | List<CommercialWarpper> commercialWarppers = commercialService.queryCommercialList(uid, type, device); |
| | | return ResponseWarpper.success(commercialWarppers); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.api; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.agentdriving.user.modular.system.model.Html; |
| | | import com.agentdriving.user.modular.system.model.SystemConfig; |
| | | import com.agentdriving.user.modular.system.service.IHtmlService; |
| | | import com.agentdriving.user.modular.system.service.ISystemConfigService; |
| | | import com.agentdriving.user.modular.system.util.ResultUtil; |
| | | import com.agentdriving.user.modular.system.warpper.ResponseWarpper; |
| | | import com.agentdriving.user.modular.system.warpper.StartPriceWarpper; |
| | | 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.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 协议控制器 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class HtmlController { |
| | | |
| | | @Autowired |
| | | private IHtmlService htmlService; |
| | | |
| | | @Autowired |
| | | private ISystemConfigService systemConfigService; |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/html/queryHtml") |
| | | // @ServiceLog(name = "获取各种协议和说明", url = "/base/html/queryHtml") |
| | | @ApiOperation(value = "获取各种协议和说明", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "类型(1=代驾服务协议与隐私政策保护,2=法律条款,3=个人信息处理规则,4=积分说明,5=佣金规则说明,6=行程录音说明,7=预估价格说明,8=加盟基本要求,9=加盟流程,10=起步价说明,11=注销协议,12=关于我们,13=司机消单说明)", name = "type", required = true, dataType = "int"), |
| | | }) |
| | | public ResponseWarpper<String> queryHtml(Integer type){ |
| | | if(null == type){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("type")); |
| | | } |
| | | try { |
| | | Html html = htmlService.selectOne(new EntityWrapper<Html>().eq("type", type)); |
| | | return ResponseWarpper.success(null == html ? "" : html.getHtml()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/html/queryStartPrice") |
| | | // @ServiceLog(name = "获取起步价和起步价说明", url = "/base/html/queryStartPrice") |
| | | @ApiOperation(value = "获取起步价和起步价说明", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResponseWarpper<StartPriceWarpper> queryStartPrice(){ |
| | | try { |
| | | Html html = htmlService.selectOne(new EntityWrapper<Html>().eq("type",10)); |
| | | StartPriceWarpper startPriceWarpper = new StartPriceWarpper(); |
| | | //{"ChargeStandard":[{"num1":"06:00","num2":"08:00","num3":2,"num4":2,"num5":2,"num6":2,"num7":2,"num8":2,"num9":2,"num10":2,"num11":2},{"num1":"06:00","num2":"08:00","num3":2,"num4":2,"num5":2,"num6":2,"num7":2,"num8":2,"num9":2,"num10":2,{"num1":"06:00","num2":"08:00","num3":2,"num4":2,"num5":2,"num6":2,"num7":2,"num8":2,"num9":2,"num10":2,"num11":2}],"ExtraCost":{"num1":1,"num2":1,"num3":1,"num4":1,"num5":1,"num6":1,"num7":1,"num8":1,"num9":1},"description":"这是一段说明文本"} |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 5)); |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | JSONArray chargeStandard = jsonObject.getJSONArray("ChargeStandard"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("HHmm"); |
| | | Integer integer = Integer.valueOf(sdf.format(new Date())); |
| | | for (int i = 0; i < chargeStandard.size(); i++) { |
| | | JSONObject jsonObject1 = chargeStandard.getJSONObject(i); |
| | | String num1 = jsonObject1.getString("num1"); |
| | | String num2 = jsonObject1.getString("num2"); |
| | | num1 = num1.replaceAll(":", ""); |
| | | num2 = num2.replaceAll(":", ""); |
| | | |
| | | Double num3 = jsonObject1.getDouble("num3"); |
| | | Double num4 = jsonObject1.getDouble("num4"); |
| | | Double num5 = jsonObject1.getDouble("num5"); |
| | | Double num6 = jsonObject1.getDouble("num6"); |
| | | if(integer >= Integer.valueOf(num1) && integer < Integer.valueOf(num2)){ |
| | | startPriceWarpper.setStartPrice(num4); |
| | | startPriceWarpper.setStartDistance(num3); |
| | | startPriceWarpper.setExcessMileageUnitPrice(num6); |
| | | startPriceWarpper.setOvermileage(num5); |
| | | break; |
| | | } |
| | | } |
| | | startPriceWarpper.setDescription(null == html ? "" : html.getHtml()); |
| | | return ResponseWarpper.success(startPriceWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.api; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.agentdriving.user.modular.system.model.MainContent; |
| | | import com.agentdriving.user.modular.system.service.IMainContentService; |
| | | import com.agentdriving.user.modular.system.util.ResultUtil; |
| | | import com.agentdriving.user.modular.system.warpper.ResponseWarpper; |
| | | 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.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 事由控制器 |
| | | * @author pzb |
| | | * @Date 2023/2/27 12:02 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class MainContentController { |
| | | |
| | | @Autowired |
| | | private IMainContentService mainContentService; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/mainContent/queryMainContent") |
| | | // @ServiceLog(name = "获取系统事由", url = "/base/mainContent/queryMainContent") |
| | | @ApiOperation(value = "获取系统事由", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "数据类型(1=转单,2=司机消单,3=用户取消订单)", name = "type", required = true, dataType = "int"), |
| | | }) |
| | | public ResponseWarpper<List<String>> queryMainContent(Integer type){ |
| | | if(null == type){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("type")); |
| | | } |
| | | try { |
| | | List<MainContent> mainContents = mainContentService.selectList(new EntityWrapper<MainContent>().eq("type", type) |
| | | .eq("status", 1).orderBy("createTime")); |
| | | List<String> list = new ArrayList<>(); |
| | | for (MainContent mainContent : mainContents) { |
| | | list.add(mainContent.getContent()); |
| | | } |
| | | return ResponseWarpper.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.api; |
| | | |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.agentdriving.user.modular.system.model.Driver; |
| | | import com.agentdriving.user.modular.system.service.*; |
| | | import com.agentdriving.user.modular.system.warpper.*; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.agentdriving.user.modular.system.model.AppUser; |
| | | import com.agentdriving.user.modular.system.model.Order; |
| | | import com.agentdriving.user.modular.system.model.Revenue; |
| | | import com.agentdriving.user.modular.system.service.*; |
| | | import com.agentdriving.user.modular.system.util.MallBook.model.InterfaceResponse; |
| | | import com.agentdriving.user.modular.system.util.MallBook.model.Receive; |
| | | import com.agentdriving.user.modular.system.util.MallBook.model.ReceiveUser; |
| | | import com.agentdriving.user.modular.system.util.MallBook.util.RSASignature; |
| | | import com.agentdriving.user.modular.system.util.MallBook.util.TrhRequest; |
| | | import com.agentdriving.user.modular.system.util.PayMoneyUtil; |
| | | import com.agentdriving.user.modular.system.util.ResultUtil; |
| | | import com.agentdriving.user.modular.system.warpper.*; |
| | | 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 javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 订单控制器 |
| | | * @author pzb |
| | | * @Date 2023/2/28 11:24 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class OrderController { |
| | | |
| | | @Autowired |
| | | private IOrderService orderService; |
| | | |
| | | @Autowired |
| | | private IAppUserService appUserService; |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Autowired |
| | | private IBillService billService; |
| | | |
| | | @Autowired |
| | | private IRevenueService revenueService; |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryServerOrder") |
| | | // @ServiceLog(name = "获取正在进行中的订单id", url = "/api/order/queryServerOrder") |
| | | @ApiOperation(value = "获取正在进行中的订单id", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<List<Long>> queryServerOrder(){ |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | List<Integer> list = Arrays.asList(101, 102, 103, 104, 105, 106, 107, 201, 401); |
| | | List<Order> orders = orderService.selectList(new EntityWrapper<Order>().eq("userPhone", appUser.getPhone()).eq("status", 1).in("state", list)); |
| | | List<Long> collect = orders.stream().map(Order::getId).collect(Collectors.toList()); |
| | | return ResponseWarpper.success(collect); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/getEstimatedCosts") |
| | | // @ServiceLog(name = "获取预估费用", url = "/api/order/getEstimatedCosts") |
| | | @ApiOperation(value = "获取预估费用", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<EstimatedCostsWarpper> getEstimatedCosts(EstimatedCosts estimatedCosts){ |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil<EstimatedCostsWarpper> estimatedCosts1 = orderService.getEstimatedCosts(uid, estimatedCosts); |
| | | return ResponseWarpper.success(estimatedCosts1); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/travelOrder") |
| | | // @ServiceLog(name = "用户下单/扫码下单", url = "/api/order/travelOrder") |
| | | @ApiOperation(value = "用户下单/扫码下单", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper travelOrder(TravelOrder travelOrder){ |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil resultUtil = orderService.travelOrder(uid, travelOrder); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/cancelOrder") |
| | | // @ServiceLog(name = "用户取消订单", url = "/api/order/cancelOrder") |
| | | @ApiOperation(value = "用户取消订单", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | @ApiImplicitParam(value = "取消原因", name = "cause", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper cancelOrder(Long orderId, String cause){ |
| | | if(null == orderId){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | | if(ToolUtil.isEmpty(cause)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("cause")); |
| | | } |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil resultUtil = orderService.cancelOrder(uid, orderId, cause); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryOrderInfo") |
| | | // @ServiceLog(name = "获取订单详情", url = "/api/order/queryOrderInfo") |
| | | @ApiOperation(value = "获取订单详情", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<OrderInfoWarpper> queryOrderInfo(Long orderId){ |
| | | if(null == orderId){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | OrderInfoWarpper orderInfoWarpper = orderService.queryOrderInfo(uid, orderId); |
| | | return ResponseWarpper.success(orderInfoWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/order/queryShareOrderInfo") |
| | | // @ServiceLog(name = "获取订单详情", url = "/base/order/queryShareOrderInfo") |
| | | @ApiOperation(value = "获取订单详情", tags = {"用户端-分享"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | }) |
| | | public ResponseWarpper<OrderInfoWarpper> queryOrderInfo1(Long orderId){ |
| | | if(null == orderId){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | | try { |
| | | OrderInfoWarpper orderInfoWarpper = orderService.queryOrderInfo(null, orderId); |
| | | return ResponseWarpper.success(orderInfoWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/editOrderEndAddress") |
| | | // @ServiceLog(name = "修改终点", url = "/api/order/editOrderEndAddress") |
| | | @ApiOperation(value = "修改终点", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper editOrderEndAddress(EditOrderEndAddress editOrderEndAddress){ |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil resultUtil = orderService.editOrderEndAddress(uid, editOrderEndAddress); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryOrderPrice") |
| | | // @ServiceLog(name = "获取订单费用明细", url = "/api/order/queryOrderPrice") |
| | | @ApiOperation(value = "获取订单费用明细", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<OrderPriceWarpper> queryOrderPrice(Long orderId){ |
| | | if(null == orderId){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | OrderPriceWarpper orderPriceWarpper = orderService.queryOrderPrice(uid, orderId); |
| | | return ResponseWarpper.success(orderPriceWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/calculationOfExpenses") |
| | | // @ServiceLog(name = "重新计算待支付页面订单费用明细", url = "/api/order/calculationOfExpenses") |
| | | @ApiOperation(value = "重新计算待支付页面订单费用明细", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | @ApiImplicitParam(value = "优惠券id", name = "couponId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "是否使用余额抵扣(0=否,1=是)", name = "payType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "抵扣金额", name = "balance", required = true, dataType = "double"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<OrderPriceWarpper> calculationOfExpenses(Long orderId, Integer couponId, Integer payType, Double balance){ |
| | | if(null == orderId){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | | if(null == payType){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("payType")); |
| | | } |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | OrderPriceWarpper orderPriceWarpper = orderService.calculationOfExpenses(uid, orderId, couponId, payType, balance); |
| | | return ResponseWarpper.success(orderPriceWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryPayCouponList") |
| | | // @ServiceLog(name = "获取支付页面优惠券选择列表", url = "/api/order/queryPayCouponList") |
| | | @ApiOperation(value = "获取支付页面优惠券选择列表", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<List<CouponWarpper>> queryPayCouponList(Long orderId){ |
| | | if(null == orderId){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | List<CouponWarpper> list = orderService.queryPayCouponList(uid, orderId); |
| | | return ResponseWarpper.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/orderPayment") |
| | | // @ServiceLog(name = "订单完成后的支付操作", url = "/api/order/orderPayment") |
| | | @ApiOperation(value = "订单完成后的支付操作", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper orderPayment(OrderPayment orderPayment){ |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil resultUtil = orderService.orderPayment(uid, orderPayment); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 订单微信支付回调处理 |
| | | * @param request |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/order/orderPayCallback") |
| | | public void orderPayCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | String code = request.getParameter("code"); |
| | | String version = request.getParameter("version"); |
| | | String msg = request.getParameter("msg"); |
| | | String date = request.getParameter("date"); |
| | | String result = request.getParameter("result"); |
| | | String sign = request.getParameter("sign"); |
| | | InterfaceResponse interfaceResponse = new InterfaceResponse(); |
| | | interfaceResponse.setCode(code); |
| | | interfaceResponse.setVersion(version); |
| | | interfaceResponse.setMsg(msg); |
| | | interfaceResponse.setDate(date); |
| | | interfaceResponse.setResult(result); |
| | | interfaceResponse.setSign(sign); |
| | | // 验签 |
| | | boolean verify = RSASignature.validate(interfaceResponse.content(), interfaceResponse.getSign()); |
| | | if (verify) {//验签成功业务处理逻辑 |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | String orderId = jsonObject.getString("parameter1"); |
| | | ResultUtil resultUtil = orderService.orderPayCallback(orderId, merOrderId); |
| | | if(resultUtil.getCode() == 10000){ |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("OK"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } else {//验签失败业务处理逻辑 |
| | | System.err.println("支付回调验签失败"); |
| | | } |
| | | |
| | | |
| | | // Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | // if(null != map){ |
| | | // String out_trade_no = map.get("out_trade_no"); |
| | | // String transaction_id = map.get("transaction_id"); |
| | | // String result = map.get("result"); |
| | | // String orderId = out_trade_no.substring(17); |
| | | // ResultUtil resultUtil = orderService.orderPayCallback(orderId, transaction_id); |
| | | // if(resultUtil.getCode() == 10000){ |
| | | // PrintWriter out = response.getWriter(); |
| | | // out.print(result); |
| | | // out.flush(); |
| | | // out.close(); |
| | | // } |
| | | // } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 异步分账回调 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/order/ledgerCallback") |
| | | public void ledgerCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | try{ |
| | | String code = request.getParameter("code"); |
| | | String version = request.getParameter("version"); |
| | | String msg = request.getParameter("msg"); |
| | | String date = request.getParameter("date"); |
| | | String result = request.getParameter("result"); |
| | | String sign = request.getParameter("sign"); |
| | | InterfaceResponse interfaceResponse = new InterfaceResponse(); |
| | | interfaceResponse.setCode(code); |
| | | interfaceResponse.setVersion(version); |
| | | interfaceResponse.setMsg(msg); |
| | | interfaceResponse.setDate(date); |
| | | interfaceResponse.setResult(result); |
| | | interfaceResponse.setSign(sign); |
| | | // 验签 |
| | | boolean verify = RSASignature.validate(interfaceResponse.content(), interfaceResponse.getSign()); |
| | | if (verify) {//验签成功业务处理逻辑 |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | String orderId = jsonObject.getString("parameter1"); |
| | | //确认收货 |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Order order = orderService.selectById(orderId); |
| | | List<Revenue> revenues = revenueService.selectList(new EntityWrapper<Revenue>().eq("userType", 2).eq("orderId", order.getId())); |
| | | Receive receive = new Receive();//确认收货 |
| | | receive.setOriginalMerOrderId(merOrderId); |
| | | receive.setRcvAmount(String.valueOf(order.getPayMoney() * 100)); |
| | | List<ReceiveUser> splitList = new ArrayList<>(); |
| | | for (Revenue revenue : revenues) { |
| | | Driver driver = driverService.selectById(revenue.getUserId()); |
| | | ReceiveUser receiveUser = new ReceiveUser(); |
| | | receiveUser.setSplitUserId(driver.getMerchantNumber()); |
| | | receiveUser.setRcvSplitAmount(revenue.getAmount().toString()); |
| | | splitList.add(receiveUser); |
| | | } |
| | | receive.setSplitList(splitList); |
| | | TrhRequest<Receive> request1 = new TrhRequest(); |
| | | InterfaceResponse execute = request1.execute(receive, Receive.SERVICE_CODE); |
| | | if(!"0000".equals(execute.getResult())){ |
| | | System.err.println("确认收货" + execute.getMsg()); |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | String status = jsonObject.getString("status"); |
| | | if("2".equals(status)){ |
| | | System.err.println("确认收货失败"); |
| | | } |
| | | if("0".equals(status)){ |
| | | System.err.println("确认收货处理中"); |
| | | } |
| | | } |
| | | }, 30000); |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("OK"); |
| | | out.flush(); |
| | | out.close(); |
| | | } else {//验签失败业务处理逻辑 |
| | | System.err.println("支付回调验签失败"); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/orderAppraise") |
| | | // @ServiceLog(name = "订单评价操作", url = "/api/order/orderAppraise") |
| | | @ApiOperation(value = "订单评价操作", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | @ApiImplicitParam(value = "评分", name = "score", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "评价内容", name = "content", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper orderAppraise(Long orderId, Integer score, String content){ |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil resultUtil = orderService.orderAppraise(uid, orderId, score, content); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryMyOrder") |
| | | // @ServiceLog(name = "获取我的行程", url = "/api/order/queryMyOrder") |
| | | @ApiOperation(value = "获取我的行程", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "pageSize", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<List<OrderListWarpper>> queryMyOrder(Integer pageNum, Integer pageSize){ |
| | | if(null == pageNum){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); |
| | | } |
| | | if(null == pageSize){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageSize")); |
| | | } |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | List<OrderListWarpper> orderListWarppers = orderService.queryMyOrder(uid, pageNum, pageSize); |
| | | return ResponseWarpper.success(orderListWarppers); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryNotInvoiceOrder") |
| | | // @ServiceLog(name = "获取未开票订单列表", url = "/api/order/queryNotInvoiceOrder") |
| | | @ApiOperation(value = "获取未开票订单列表", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<List<OrderListWarpper>> queryNotInvoiceOrder(NotInvoiceOrder notInvoiceOrder){ |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | List<OrderListWarpper> orderListWarppers = orderService.queryNotInvoiceOrder(uid, notInvoiceOrder); |
| | | return ResponseWarpper.success(orderListWarppers); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/invoicing") |
| | | // @ServiceLog(name = "开票操作", url = "/api/order/invoicing") |
| | | @ApiOperation(value = "开票操作", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper invoicing(Invoicing invoicing){ |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil invoicing1 = billService.invoicing(uid, invoicing); |
| | | return ResponseWarpper.success(invoicing1); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryBillList") |
| | | // @ServiceLog(name = "获取开票历史", url = "/api/order/queryBillList") |
| | | @ApiOperation(value = "获取开票历史", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "pageSize", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<List<BillWarpper>> queryBillList(Integer pageNum, Integer pageSize){ |
| | | if(null == pageNum){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); |
| | | } |
| | | if(null == pageSize){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageSize")); |
| | | } |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | List<BillWarpper> billWarppers = billService.queryBillList(uid, pageNum, pageSize); |
| | | return ResponseWarpper.success(billWarppers); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.code.controller; |
| | | |
| | | import com.agentdriving.user.core.base.controller.BaseController; |
| | | import com.agentdriving.user.core.config.properties.DruidProperties; |
| | | import com.agentdriving.user.generator.action.config.WebGeneratorConfig; |
| | | import com.agentdriving.user.generator.action.model.GenQo; |
| | | import com.agentdriving.user.modular.code.factory.DefaultTemplateFactory; |
| | | import com.agentdriving.user.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.agentdriving.user.modular.code.factory; |
| | | |
| | | |
| | | import com.agentdriving.user.GunsApplication; |
| | | import com.agentdriving.user.core.CoreFlag; |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.agentdriving.user.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.agentdriving.user.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.agentdriving.user.modular.system.auth; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.agentdriving.user.modular.system.util.ResultUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.servlet.HandlerInterceptor; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | | @Component |
| | | public class AuthIntercepter implements HandlerInterceptor { |
| | | private final static Logger log = LoggerFactory.getLogger(AuthIntercepter.class); |
| | | |
| | | @Autowired |
| | | AuthService authService; |
| | | |
| | | @Override |
| | | public boolean preHandle(HttpServletRequest req, HttpServletResponse res, Object handler) throws IOException { |
| | | String appid = req.getParameter("appid"); |
| | | String sign = req.getParameter("sign"); |
| | | ResultUtil resultUtil = authService.checkSyncAuth(appid, sign, req); |
| | | if (resultUtil.getCode() != 200) { |
| | | res.setStatus(HttpStatus.OK.value()); |
| | | res.setHeader("Content-type", "text/html;charset=UTF-8"); |
| | | res.getWriter().print(JSON.toJSONString(resultUtil));//Res.Failure("req timeout, please try again") |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.auth; |
| | | |
| | | |
| | | import com.agentdriving.user.modular.system.util.ResultUtil; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | @Service |
| | | public class AuthService { |
| | | |
| | | private final static Logger log = LoggerFactory.getLogger(AuthService.class); |
| | | |
| | | public static final AuthService me = new AuthService(); |
| | | |
| | | /** |
| | | * 鉴权 |
| | | * @param appid |
| | | * @param sign |
| | | * @param requset |
| | | * @return |
| | | */ |
| | | public ResultUtil checkSyncAuth(String appid, String sign, HttpServletRequest requset) { |
| | | try { |
| | | if (StringUtils.isBlank(sign)) { |
| | | return ResultUtil.sign(); |
| | | } |
| | | // 1.鉴权 |
| | | String signUrl = AuthenticationKit.getSignUrl(requset, "sign"); |
| | | signUrl = signUrl.replaceAll("& #40;", "\\("); |
| | | signUrl = signUrl.replaceAll("& #41;", "\\)"); |
| | | String signUrlEncode = AuthenticationKit.signUrlEncode(signUrl, appid); |
| | | if(sign.indexOf(" ") != -1 && signUrlEncode.indexOf("+") != -1){//处理前后端加密差异 |
| | | signUrlEncode = signUrlEncode.replaceAll("\\+", " "); |
| | | } |
| | | // 签名无 |
| | | if (StringUtils.isBlank(sign) || !sign.equals(signUrlEncode)) { |
| | | return ResultUtil.sign(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.auth; |
| | | |
| | | import org.apache.tomcat.util.codec.binary.Base64; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * |
| | | * 接口鉴权工具类 |
| | | * |
| | | * @author gwx 2017-12-23 |
| | | * |
| | | */ |
| | | public class AuthenticationKit { |
| | | public static final String utf8="UTF-8"; |
| | | |
| | | /** |
| | | * 返回64 位 token |
| | | * |
| | | * @param key 自定义安全字符 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String getToken(String key) throws Exception { |
| | | // 随机生成 32位字符 |
| | | String salt = HashKit.generateSaltForSha256(); |
| | | // 获取当前时间 |
| | | long cur = System.currentTimeMillis(); |
| | | // 生成64位token |
| | | String access_token = getToken256(key, salt, cur); |
| | | return access_token; |
| | | } |
| | | |
| | | /** |
| | | * 返回64 位 token |
| | | * |
| | | * @param key |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String getToken256(String key, String salt, long cur) throws Exception { |
| | | // 生成64位token |
| | | String access_token = HashKit.sha256(salt + cur + key); |
| | | return access_token; |
| | | } |
| | | |
| | | /** |
| | | * 返回到秒 |
| | | * |
| | | * @return |
| | | */ |
| | | public static String createTimestamp() { |
| | | long l = System.currentTimeMillis(); |
| | | return Long.toString(l / 1000); |
| | | } |
| | | |
| | | /** |
| | | * 返回noce 不带 短杠"-" |
| | | * |
| | | * @return |
| | | */ |
| | | public static String createNonceStr() { |
| | | return getUUID(); |
| | | } |
| | | |
| | | public static String getUUID() { |
| | | UUID uuid = UUID.randomUUID(); |
| | | String str = uuid.toString(); |
| | | str = str.replaceAll("-", ""); |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * 组装路径 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | public static String localSignParam(Map<String, String> params) { |
| | | return localSignUrl(null, params, false); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 组装签名路径 |
| | | * @param url |
| | | * @param params |
| | | * @return |
| | | */ |
| | | public static String localSignUrl(String url, Map<String, String> params, boolean urlEncode) { |
| | | StringBuilder strBuilder = new StringBuilder(); |
| | | // if(StringUtils.isNotBlank(url) && url.lastIndexOf("?")==-1){ |
| | | // strBuilder.append(url).append("?"); |
| | | // } |
| | | |
| | | Set es = params.entrySet();//所有参与传参的参数按照accsii排序(升序) |
| | | Iterator it = es.iterator(); |
| | | while(it.hasNext()) { |
| | | Map.Entry entry = (Map.Entry)it.next(); |
| | | String k = (String)entry.getKey(); |
| | | Object v = entry.getValue(); |
| | | if(null != v && !"".equals(v)) { |
| | | strBuilder.append(k + "=" + v + "&"); |
| | | } |
| | | } |
| | | return strBuilder.substring(0, strBuilder.length() - 1); |
| | | |
| | | // for (String key : params.keySet()) { |
| | | // if (params.get(key) != null) { |
| | | // String lowerKey = key.toLowerCase(); |
| | | // String encodeKey = lowerKey; |
| | | // String encodedValue = params.get(key); |
| | | // if (urlEncode){ |
| | | // encodeKey = UrlEncoderUtils.encode(lowerKey); |
| | | // encodedValue = UrlEncoderUtils.encode(encodedValue); |
| | | // } |
| | | // if (!seeOne) { |
| | | // seeOne = true; |
| | | // } else { |
| | | // strBuilder.append("&"); |
| | | // } |
| | | // strBuilder.append(encodeKey).append("=").append(encodedValue); |
| | | // } |
| | | // } |
| | | // return strBuilder.toString(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 加密签名路径生成签名 |
| | | * |
| | | * @param signUrl |
| | | * /token?appid=12345×tamp=1512440267&nonce=12345 |
| | | * @param encryptKey |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String signUrlEncode(String signUrl, String encryptKey) throws Exception { |
| | | byte[] signByte = HMACSHA1.HmacSHA1Encrypt(signUrl, encryptKey); |
| | | String localSign = Base64.encodeBase64String(signByte); |
| | | return localSign; |
| | | } |
| | | |
| | | /** |
| | | * 返回鉴权 签名路径 |
| | | * |
| | | * @param req |
| | | * @return |
| | | */ |
| | | public static String getSignUrl(HttpServletRequest req) { |
| | | return getSignUrl(req,""); |
| | | } |
| | | |
| | | /** |
| | | * 服务端 获取 客户端请求 组装验证签名 |
| | | * @param req |
| | | * @param delParams 移除不相关 的签名参数 |
| | | * @return |
| | | */ |
| | | public static String getSignUrl(HttpServletRequest req, String... delParams) { |
| | | // 获取相对的访问路径 |
| | | String url = req.getServletPath(); |
| | | Map<String, String> paramMap = packageRequestGetParams(req); |
| | | if (paramMap.size() > 0) { |
| | | // 删除 |
| | | for (int i = 0, len = delParams.length; i < len; i++) { |
| | | paramMap.remove(delParams[i]); |
| | | } |
| | | return localSignUrl(url, paramMap, false); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 组装签名路径 客户端测试用 |
| | | * @param url api访问地址 "/apid" |
| | | * @param appid |
| | | * @return |
| | | */ |
| | | public static String getSignUrl(String url, String appid, Map<String, String> queryParas) { |
| | | Map<String, String> params = new TreeMap<String, String>(); |
| | | params.put("appid", appid); |
| | | params.put("nonce", createNonceStr()); |
| | | params.put("timestamp", createTimestamp()); |
| | | if(queryParas!=null && queryParas.size()>0){ |
| | | params.putAll(queryParas); |
| | | } |
| | | return localSignUrl(url, params, false); |
| | | } |
| | | |
| | | /** |
| | | * 组装签名路径 客户端测试用 |
| | | * @param url api访问地址 "/apid" |
| | | * @param appid |
| | | * @return |
| | | */ |
| | | public static String getSignUrl(String url, String appid) { |
| | | return getSignUrl(url, appid, ""); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param url |
| | | * @param appid |
| | | * @param params |
| | | * @return |
| | | */ |
| | | public static String getSignUrl(String url, String appid, String params) { |
| | | String urlTmp = getSignUrl(url, appid, new HashMap<String,String>()); |
| | | return urlTmp + UrlEncoderUtils.encode(params); |
| | | } |
| | | |
| | | /** |
| | | * 解析get参数返回treemap |
| | | * @param req |
| | | * @return |
| | | */ |
| | | public static Map<String, String> packageRequestGetParams( |
| | | HttpServletRequest req) { |
| | | Map<String, String> paramMap = new TreeMap<String, String>(); |
| | | Enumeration pNames = req.getParameterNames(); |
| | | while (pNames.hasMoreElements()) { |
| | | String key = (String) pNames.nextElement(); |
| | | String value = req.getParameter(key); |
| | | paramMap.put(key, value); |
| | | } |
| | | return paramMap; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.auth; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
| | | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
| | | |
| | | |
| | | @Component |
| | | public class Configuration implements WebMvcConfigurer { |
| | | |
| | | @Autowired |
| | | private AuthIntercepter authIntercepter; |
| | | |
| | | /** |
| | | * 重写添加拦截器方法并添加配置拦截器 |
| | | * |
| | | * @param registry |
| | | */ |
| | | @Override |
| | | public void addInterceptors(InterceptorRegistry registry) { |
| | | // registry.addInterceptor(authIntercepter).addPathPatterns("/api/**") |
| | | // .excludePathPatterns("/base/**"); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.auth; |
| | | |
| | | import org.apache.commons.codec.binary.Base64; |
| | | |
| | | import javax.crypto.Mac; |
| | | import javax.crypto.SecretKey; |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | |
| | | public class HMACSHA1 { |
| | | |
| | | private static final String MAC_NAME = "HmacSHA1"; |
| | | private static final String ENCODING = "UTF-8"; |
| | | |
| | | /* |
| | | * 展示了一个生成指定算法密钥的过程 初始化HMAC密钥 |
| | | * |
| | | * @return |
| | | * |
| | | * @throws Exception |
| | | * |
| | | * public static String initMacKey() throws Exception { //得到一个 指定算法密钥的密钥生成器 |
| | | * KeyGenerator KeyGenerator keyGenerator |
| | | * =KeyGenerator.getInstance(MAC_NAME); //生成一个密钥 SecretKey secretKey |
| | | * =keyGenerator.generateKey(); return null; } |
| | | */ |
| | | |
| | | /** |
| | | * 使用 HMAC-SHA1 签名方法对对encryptText进行签名 |
| | | * |
| | | * @param encryptText |
| | | * 被签名的字符串 |
| | | * @param encryptKey |
| | | * 密钥 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static byte[] HmacSHA1Encrypt(String encryptText, String encryptKey) throws Exception { |
| | | byte[] data = encryptKey.getBytes(ENCODING); |
| | | // 根据给定的字节数组构造一个密钥,第二参数指定一个密钥算法的名称 |
| | | Mac mac = Mac.getInstance(MAC_NAME); |
| | | SecretKey secretKey = new SecretKeySpec(data, MAC_NAME); |
| | | // 生成一个指定 Mac 算法 的 Mac 对象 |
| | | // 用给定密钥初始化 Mac 对象 |
| | | mac.init(secretKey); |
| | | |
| | | byte[] text = encryptText.getBytes(ENCODING); |
| | | // 完成 Mac 操作 |
| | | return mac.doFinal(text); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | String encryptText = "123"; |
| | | String encryptKey = "adc"; |
| | | try { |
| | | byte[] b = HmacSHA1Encrypt(encryptText, encryptKey); |
| | | String str = HashKit.toHex(b); |
| | | String str2 = new String(Base64.encodeBase64(b)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.auth; |
| | | /** |
| | | * Copyright (c) 2011-2017, James Zhan 詹波 (jfinal@126.com). |
| | | * |
| | | * 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 |
| | | * |
| | | * 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. |
| | | */ |
| | | |
| | | import java.security.MessageDigest; |
| | | |
| | | public class HashKit { |
| | | |
| | | public static final long FNV_OFFSET_BASIS_64 = 0xcbf29ce484222325L; |
| | | public static final long FNV_PRIME_64 = 0x100000001b3L; |
| | | |
| | | private static final java.security.SecureRandom random = new java.security.SecureRandom(); |
| | | private static final char[] HEX_DIGITS = "0123456789abcdef".toCharArray(); |
| | | private static final char[] CHAR_ARRAY = "_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| | | .toCharArray(); |
| | | |
| | | public static long fnv1a64(String key) { |
| | | long hash = FNV_OFFSET_BASIS_64; |
| | | for (int i = 0, size = key.length(); i < size; i++) { |
| | | hash ^= key.charAt(i); |
| | | hash *= FNV_PRIME_64; |
| | | } |
| | | return hash; |
| | | } |
| | | |
| | | public static String md5(String srcStr) { |
| | | return hash("MD5", srcStr); |
| | | } |
| | | |
| | | public static String sha1(String srcStr) { |
| | | return hash("SHA-1", srcStr); |
| | | } |
| | | |
| | | public static String sha256(String srcStr) { |
| | | return hash("SHA-256", srcStr); |
| | | } |
| | | |
| | | public static String sha384(String srcStr) { |
| | | return hash("SHA-384", srcStr); |
| | | } |
| | | |
| | | public static String sha512(String srcStr) { |
| | | return hash("SHA-512", srcStr); |
| | | } |
| | | |
| | | public static String hash(String algorithm, String srcStr) { |
| | | try { |
| | | MessageDigest md = MessageDigest.getInstance(algorithm); |
| | | byte[] bytes = md.digest(srcStr.getBytes("utf-8")); |
| | | return toHex(bytes); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | public static String toHex(byte[] bytes) { |
| | | StringBuilder ret = new StringBuilder(bytes.length * 2); |
| | | for (int i = 0; i < bytes.length; i++) { |
| | | ret.append(HEX_DIGITS[(bytes[i] >> 4) & 0x0f]); |
| | | ret.append(HEX_DIGITS[bytes[i] & 0x0f]); |
| | | } |
| | | return ret.toString(); |
| | | } |
| | | |
| | | /** |
| | | * md5 128bit 16bytes sha1 160bit 20bytes sha256 256bit 32bytes sha384 |
| | | * 384bit 48bytes sha512 512bit 64bytes |
| | | */ |
| | | public static String generateSalt(int saltLength) { |
| | | StringBuilder salt = new StringBuilder(saltLength); |
| | | for (int i = 0; i < saltLength; i++) { |
| | | salt.append(CHAR_ARRAY[random.nextInt(CHAR_ARRAY.length)]); |
| | | } |
| | | return salt.toString(); |
| | | } |
| | | |
| | | public static String generateSaltForSha256() { |
| | | return generateSalt(32); |
| | | } |
| | | |
| | | public static String generateSaltForSha512() { |
| | | return generateSalt(64); |
| | | } |
| | | |
| | | public static boolean slowEquals(byte[] a, byte[] b) { |
| | | if (a == null || b == null) { |
| | | return false; |
| | | } |
| | | |
| | | int diff = a.length ^ b.length; |
| | | for (int i = 0; i < a.length && i < b.length; i++) { |
| | | diff |= a[i] ^ b[i]; |
| | | } |
| | | return diff == 0; |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.auth; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLEncoder; |
| | | |
| | | public class UrlEncoderUtils { |
| | | |
| | | private static final String PATH_DELIMITER = "/"; |
| | | private static final Logger log = LoggerFactory.getLogger(UrlEncoderUtils.class); |
| | | |
| | | public static String encode(String originUrl) { |
| | | try { |
| | | return URLEncoder.encode(originUrl, "UTF-8").replace("+", "%20").replace("*", "%2A") |
| | | .replace("%7E", "~"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | log.error("URLEncoder error, encode utf8, exception: {}", e); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | // encode路径, 不包括分隔符 |
| | | public static String encodeEscapeDelimiter(String urlPath) { |
| | | StringBuilder pathBuilder = new StringBuilder(); |
| | | String[] pathSegmentsArr = urlPath.split(PATH_DELIMITER); |
| | | |
| | | boolean isFirstSegMent = true; |
| | | for (String pathSegment : pathSegmentsArr) { |
| | | if (isFirstSegMent) { |
| | | pathBuilder.append(encode(pathSegment)); |
| | | isFirstSegMent = false; |
| | | } else { |
| | | pathBuilder.append(PATH_DELIMITER).append(encode(pathSegment)); |
| | | } |
| | | } |
| | | if (urlPath.endsWith(PATH_DELIMITER)) { |
| | | pathBuilder.append(PATH_DELIMITER); |
| | | } |
| | | return pathBuilder.toString(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.controller; |
| | | |
| | | import com.agentdriving.user.core.base.controller.BaseController; |
| | | import com.agentdriving.user.modular.system.service.INoticeService; |
| | | 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 java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 总览信息 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年3月4日23:05:54 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/blackboard") |
| | | public class BlackboardController extends BaseController { |
| | | |
| | | @Autowired |
| | | private INoticeService noticeService; |
| | | |
| | | /** |
| | | * 跳转到黑板 |
| | | */ |
| | | @RequestMapping("") |
| | | public String blackboard(Model model) { |
| | | List<Map<String, Object>> notices = noticeService.list(null); |
| | | model.addAttribute("noticeList", notices); |
| | | return "/blackboard.html"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.controller; |
| | | |
| | | import com.agentdriving.user.core.base.controller.BaseController; |
| | | import com.agentdriving.user.core.common.annotion.BussinessLog; |
| | | import com.agentdriving.user.core.common.annotion.Permission; |
| | | import com.agentdriving.user.core.common.constant.dictmap.DeptDict; |
| | | import com.agentdriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.agentdriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.agentdriving.user.core.exception.GunsException; |
| | | import com.agentdriving.user.core.log.LogObjectHolder; |
| | | import com.agentdriving.user.core.node.ZTreeNode; |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.agentdriving.user.modular.system.model.Dept; |
| | | import com.agentdriving.user.modular.system.service.IDeptService; |
| | | import com.agentdriving.user.modular.system.warpper.DeptWarpper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 部门控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年2月17日20:27:22 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/dept") |
| | | public class DeptController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/dept/"; |
| | | |
| | | @Autowired |
| | | private IDeptService deptService; |
| | | |
| | | /** |
| | | * 跳转到部门管理首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "dept.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加部门 |
| | | */ |
| | | @RequestMapping("/dept_add") |
| | | public String deptAdd() { |
| | | return PREFIX + "dept_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改部门 |
| | | */ |
| | | @Permission |
| | | @RequestMapping("/dept_update/{deptId}") |
| | | public String deptUpdate(@PathVariable Integer deptId, Model model) { |
| | | Dept dept = deptService.selectById(deptId); |
| | | model.addAttribute(dept); |
| | | model.addAttribute("pName", ConstantFactory.me().getDeptName(dept.getPid())); |
| | | LogObjectHolder.me().set(dept); |
| | | return PREFIX + "dept_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取部门的tree列表 |
| | | */ |
| | | @RequestMapping(value = "/tree") |
| | | @ResponseBody |
| | | public List<ZTreeNode> tree() { |
| | | List<ZTreeNode> tree = this.deptService.tree(); |
| | | tree.add(ZTreeNode.createParent()); |
| | | return tree; |
| | | } |
| | | |
| | | /** |
| | | * 新增部门 |
| | | */ |
| | | @BussinessLog(value = "添加部门", key = "simplename", dict = DeptDict.class) |
| | | @RequestMapping(value = "/add") |
| | | @Permission |
| | | @ResponseBody |
| | | public Object add(Dept dept) { |
| | | if (ToolUtil.isOneEmpty(dept, dept.getSimplename())) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | //完善pids,根据pid拿到pid的pids |
| | | deptSetPids(dept); |
| | | return this.deptService.insert(dept); |
| | | } |
| | | |
| | | /** |
| | | * 获取所有部门列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @Permission |
| | | @ResponseBody |
| | | public Object list(String condition) { |
| | | List<Map<String, Object>> list = this.deptService.list(condition); |
| | | return super.warpObject(new DeptWarpper(list)); |
| | | } |
| | | |
| | | /** |
| | | * 部门详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{deptId}") |
| | | @Permission |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("deptId") Integer deptId) { |
| | | return deptService.selectById(deptId); |
| | | } |
| | | |
| | | /** |
| | | * 修改部门 |
| | | */ |
| | | @BussinessLog(value = "修改部门", key = "simplename", dict = DeptDict.class) |
| | | @RequestMapping(value = "/update") |
| | | @Permission |
| | | @ResponseBody |
| | | public Object update(Dept dept) { |
| | | if (ToolUtil.isEmpty(dept) || dept.getId() == null) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | deptSetPids(dept); |
| | | deptService.updateById(dept); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除部门 |
| | | */ |
| | | @BussinessLog(value = "删除部门", key = "deptId", dict = DeptDict.class) |
| | | @RequestMapping(value = "/delete") |
| | | @Permission |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer deptId) { |
| | | |
| | | //缓存被删除的部门名称 |
| | | LogObjectHolder.me().set(ConstantFactory.me().getDeptName(deptId)); |
| | | |
| | | deptService.deleteDept(deptId); |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | private void deptSetPids(Dept dept) { |
| | | if (ToolUtil.isEmpty(dept.getPid()) || dept.getPid().equals(0)) { |
| | | dept.setPid(0); |
| | | dept.setPids("[0],"); |
| | | } else { |
| | | int pid = dept.getPid(); |
| | | Dept temp = deptService.selectById(pid); |
| | | String pids = temp.getPids(); |
| | | dept.setPid(pid); |
| | | dept.setPids(pids + "[" + pid + "],"); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.controller; |
| | | |
| | | import com.agentdriving.user.core.base.controller.BaseController; |
| | | import com.agentdriving.user.core.common.annotion.BussinessLog; |
| | | import com.agentdriving.user.core.common.annotion.Permission; |
| | | import com.agentdriving.user.core.common.constant.Const; |
| | | import com.agentdriving.user.core.common.constant.dictmap.DictMap; |
| | | import com.agentdriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.agentdriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.agentdriving.user.core.exception.GunsException; |
| | | import com.agentdriving.user.core.log.LogObjectHolder; |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.agentdriving.user.modular.system.model.Dict; |
| | | import com.agentdriving.user.modular.system.service.IDictService; |
| | | import com.agentdriving.user.modular.system.warpper.DictWarpper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 字典控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年4月26日 12:55:31 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/dict") |
| | | public class DictController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/dict/"; |
| | | |
| | | @Autowired |
| | | private IDictService dictService; |
| | | |
| | | /** |
| | | * 跳转到字典管理首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "dict.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加字典 |
| | | */ |
| | | @RequestMapping("/dict_add") |
| | | public String deptAdd() { |
| | | return PREFIX + "dict_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改字典 |
| | | */ |
| | | @Permission(Const.ADMIN_NAME) |
| | | @RequestMapping("/dict_edit/{dictId}") |
| | | public String deptUpdate(@PathVariable Integer dictId, Model model) { |
| | | Dict dict = dictService.selectById(dictId); |
| | | model.addAttribute("dict", dict); |
| | | List<Dict> subDicts = dictService.selectList(new EntityWrapper<Dict>().eq("pid", dictId)); |
| | | model.addAttribute("subDicts", subDicts); |
| | | LogObjectHolder.me().set(dict); |
| | | return PREFIX + "dict_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 新增字典 |
| | | * |
| | | * @param dictValues 格式例如 "1:启用;2:禁用;3:冻结" |
| | | */ |
| | | @BussinessLog(value = "添加字典记录", key = "dictName,dictValues", dict = DictMap.class) |
| | | @RequestMapping(value = "/add") |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Object add(String dictCode,String dictTips,String dictName, String dictValues) { |
| | | if (ToolUtil.isOneEmpty(dictCode,dictName, dictValues)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | this.dictService.addDict(dictCode,dictName,dictTips,dictValues); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 获取所有字典列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Object list(String condition) { |
| | | List<Map<String, Object>> list = this.dictService.list(condition); |
| | | return super.warpObject(new DictWarpper(list)); |
| | | } |
| | | |
| | | /** |
| | | * 字典详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{dictId}") |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("dictId") Integer dictId) { |
| | | return dictService.selectById(dictId); |
| | | } |
| | | |
| | | /** |
| | | * 修改字典 |
| | | */ |
| | | @BussinessLog(value = "修改字典", key = "dictName,dictValues", dict = DictMap.class) |
| | | @RequestMapping(value = "/update") |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Object update(Integer dictId,String dictCode,String dictName, String dictTips,String dictValues) { |
| | | if (ToolUtil.isOneEmpty(dictId, dictCode, dictName, dictValues)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | dictService.editDict(dictId, dictCode,dictName, dictTips,dictValues); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除字典记录 |
| | | */ |
| | | @BussinessLog(value = "删除字典记录", key = "dictId", dict = DictMap.class) |
| | | @RequestMapping(value = "/delete") |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer dictId) { |
| | | |
| | | //缓存被删除的名称 |
| | | LogObjectHolder.me().set(ConstantFactory.me().getDictName(dictId)); |
| | | |
| | | this.dictService.delteDict(dictId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.controller; |
| | | |
| | | import com.agentdriving.user.config.properties.GunsProperties; |
| | | import com.agentdriving.user.core.util.FileUtil; |
| | | import com.google.code.kaptcha.Constants; |
| | | import com.google.code.kaptcha.Producer; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * 验证码生成 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-05 23:10 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/kaptcha") |
| | | public class KaptchaController { |
| | | |
| | | @Autowired |
| | | private GunsProperties gunsProperties; |
| | | |
| | | @Autowired |
| | | private Producer producer; |
| | | |
| | | /** |
| | | * 生成验证码 |
| | | */ |
| | | @RequestMapping("") |
| | | public void index(HttpServletRequest request, HttpServletResponse response) { |
| | | HttpSession session = request.getSession(); |
| | | |
| | | response.setDateHeader("Expires", 0); |
| | | |
| | | // Set standard HTTP/1.1 no-cache headers. |
| | | response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate"); |
| | | |
| | | // Set IE extended HTTP/1.1 no-cache headers (use addHeader). |
| | | response.addHeader("Cache-Control", "post-check=0, pre-check=0"); |
| | | |
| | | // Set standard HTTP/1.0 no-cache header. |
| | | response.setHeader("Pragma", "no-cache"); |
| | | |
| | | // return a jpeg |
| | | response.setContentType("image/jpeg"); |
| | | |
| | | // create the text for the image |
| | | String capText = producer.createText(); |
| | | |
| | | // store the text in the session |
| | | session.setAttribute(Constants.KAPTCHA_SESSION_KEY, capText); |
| | | |
| | | // create the image with the text |
| | | BufferedImage bi = producer.createImage(capText); |
| | | ServletOutputStream out = null; |
| | | try { |
| | | out = response.getOutputStream(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | // write the data out |
| | | try { |
| | | ImageIO.write(bi, "jpg", out); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | try { |
| | | try { |
| | | out.flush(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } finally { |
| | | try { |
| | | out.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 返回图片 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/24 23:00 |
| | | */ |
| | | @RequestMapping("/{pictureId}") |
| | | public void renderPicture(@PathVariable("pictureId") String pictureId, HttpServletResponse response) { |
| | | String path = gunsProperties.getFileUploadPath() + pictureId; |
| | | try { |
| | | byte[] bytes = FileUtil.toByteArray(path); |
| | | response.getOutputStream().write(bytes); |
| | | } catch (Exception e) { |
| | | //如果找不到图片就返回一个默认图片 |
| | | try { |
| | | response.sendRedirect("/static/img/girl.gif"); |
| | | } catch (IOException e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.controller; |
| | | |
| | | import com.agentdriving.user.core.base.controller.BaseController; |
| | | import com.agentdriving.user.core.common.annotion.BussinessLog; |
| | | import com.agentdriving.user.core.common.annotion.Permission; |
| | | import com.agentdriving.user.core.common.constant.Const; |
| | | import com.agentdriving.user.core.common.constant.factory.PageFactory; |
| | | import com.agentdriving.user.core.common.constant.state.BizLogType; |
| | | import com.agentdriving.user.core.support.BeanKit; |
| | | import com.baomidou.mybatisplus.mapper.SqlRunner; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.agentdriving.user.modular.system.model.OperationLog; |
| | | import com.agentdriving.user.modular.system.service.IOperationLogService; |
| | | import com.agentdriving.user.modular.system.warpper.LogWarpper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 日志管理的控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年4月5日 19:45:36 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/log") |
| | | public class LogController extends BaseController { |
| | | |
| | | private static String PREFIX = "/system/log/"; |
| | | |
| | | @Autowired |
| | | private IOperationLogService operationLogService; |
| | | |
| | | /** |
| | | * 跳转到日志管理的首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "log.html"; |
| | | } |
| | | |
| | | /** |
| | | * 查询操作日志列表 |
| | | */ |
| | | @RequestMapping("/list") |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Object list(@RequestParam(required = false) String beginTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String logName, @RequestParam(required = false) Integer logType) { |
| | | Page<OperationLog> page = new PageFactory<OperationLog>().defaultPage(); |
| | | List<Map<String, Object>> result = operationLogService.getOperationLogs(page, beginTime, endTime, logName, BizLogType.valueOf(logType), page.getOrderByField(), page.isAsc()); |
| | | page.setRecords((List<OperationLog>) new LogWarpper(result).warp()); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 查询操作日志详情 |
| | | */ |
| | | @RequestMapping("/detail/{id}") |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Object detail(@PathVariable Integer id) { |
| | | OperationLog operationLog = operationLogService.selectById(id); |
| | | Map<String, Object> stringObjectMap = BeanKit.beanToMap(operationLog); |
| | | return super.warpObject(new LogWarpper(stringObjectMap)); |
| | | } |
| | | |
| | | /** |
| | | * 清空日志 |
| | | */ |
| | | @BussinessLog(value = "清空业务日志") |
| | | @RequestMapping("/delLog") |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Object delLog() { |
| | | SqlRunner.db().delete("delete from sys_operation_log"); |
| | | return SUCCESS_TIP; |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.controller; |
| | | |
| | | import com.agentdriving.user.core.base.controller.BaseController; |
| | | import com.agentdriving.user.core.common.exception.InvalidKaptchaException; |
| | | import com.agentdriving.user.core.log.LogManager; |
| | | import com.agentdriving.user.core.log.factory.LogTaskFactory; |
| | | import com.agentdriving.user.core.node.MenuNode; |
| | | import com.agentdriving.user.core.shiro.ShiroKit; |
| | | import com.agentdriving.user.core.shiro.ShiroUser; |
| | | import com.agentdriving.user.core.support.HttpKit; |
| | | import com.agentdriving.user.core.util.ApiMenuFilter; |
| | | import com.agentdriving.user.core.util.KaptchaUtil; |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.google.code.kaptcha.Constants; |
| | | import com.agentdriving.user.modular.system.model.User; |
| | | import com.agentdriving.user.modular.system.service.IMenuService; |
| | | import com.agentdriving.user.modular.system.service.IUserService; |
| | | import org.apache.shiro.authc.UsernamePasswordToken; |
| | | import org.apache.shiro.subject.Subject; |
| | | 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 java.util.List; |
| | | |
| | | /** |
| | | * 登录控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年1月10日 下午8:25:24 |
| | | */ |
| | | @Controller |
| | | public class LoginController extends BaseController { |
| | | |
| | | @Autowired |
| | | private IMenuService menuService; |
| | | |
| | | @Autowired |
| | | private IUserService userService; |
| | | |
| | | /** |
| | | * 跳转到主页 |
| | | */ |
| | | @RequestMapping(value = "/", method = RequestMethod.GET) |
| | | public String index(Model model) { |
| | | //获取菜单列表 |
| | | List<Integer> roleList = ShiroKit.getUser().getRoleList(); |
| | | if (roleList == null || roleList.size() == 0) { |
| | | ShiroKit.getSubject().logout(); |
| | | model.addAttribute("tips", "该用户没有角色,无法登陆"); |
| | | return "/login.html"; |
| | | } |
| | | List<MenuNode> menus = menuService.getMenusByRoleIds(roleList); |
| | | List<MenuNode> titles = MenuNode.buildTitle(menus); |
| | | titles = ApiMenuFilter.build(titles); |
| | | |
| | | model.addAttribute("titles", titles); |
| | | |
| | | //获取用户头像 |
| | | Integer id = ShiroKit.getUser().getId(); |
| | | User user = userService.selectById(id); |
| | | String avatar = user.getAvatar(); |
| | | model.addAttribute("avatar", avatar); |
| | | |
| | | return "/index.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到登录页面 |
| | | */ |
| | | @RequestMapping(value = "/login", method = RequestMethod.GET) |
| | | public String login() { |
| | | if (ShiroKit.isAuthenticated() || ShiroKit.getUser() != null) { |
| | | return REDIRECT + "/"; |
| | | } else { |
| | | return "/login.html"; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 点击登录执行的动作 |
| | | */ |
| | | @RequestMapping(value = "/login", method = RequestMethod.POST) |
| | | public String loginVali() { |
| | | |
| | | String username = super.getPara("username").trim(); |
| | | String password = super.getPara("password").trim(); |
| | | String remember = super.getPara("remember"); |
| | | |
| | | //验证验证码是否正确 |
| | | if (KaptchaUtil.getKaptchaOnOff()) { |
| | | String kaptcha = super.getPara("kaptcha").trim(); |
| | | String code = (String) super.getSession().getAttribute(Constants.KAPTCHA_SESSION_KEY); |
| | | if (ToolUtil.isEmpty(kaptcha) || !kaptcha.equalsIgnoreCase(code)) { |
| | | throw new InvalidKaptchaException(); |
| | | } |
| | | } |
| | | |
| | | Subject currentUser = ShiroKit.getSubject(); |
| | | UsernamePasswordToken token = new UsernamePasswordToken(username, password.toCharArray()); |
| | | |
| | | if ("on".equals(remember)) { |
| | | token.setRememberMe(true); |
| | | } else { |
| | | token.setRememberMe(false); |
| | | } |
| | | |
| | | currentUser.login(token); |
| | | |
| | | ShiroUser shiroUser = ShiroKit.getUser(); |
| | | super.getSession().setAttribute("shiroUser", shiroUser); |
| | | super.getSession().setAttribute("username", shiroUser.getAccount()); |
| | | |
| | | LogManager.me().executeLog(LogTaskFactory.loginLog(shiroUser.getId(), HttpKit.getIp())); |
| | | |
| | | ShiroKit.getSession().setAttribute("sessionFlag", true); |
| | | |
| | | return REDIRECT + "/"; |
| | | } |
| | | |
| | | /** |
| | | * 退出登录 |
| | | */ |
| | | @RequestMapping(value = "/logout", method = RequestMethod.GET) |
| | | public String logOut() { |
| | | LogManager.me().executeLog(LogTaskFactory.exitLog(ShiroKit.getUser().getId(), HttpKit.getIp())); |
| | | ShiroKit.getSubject().logout(); |
| | | deleteAllCookie(); |
| | | return REDIRECT + "/login"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.controller; |
| | | |
| | | import com.agentdriving.user.core.base.controller.BaseController; |
| | | import com.agentdriving.user.core.common.annotion.BussinessLog; |
| | | import com.agentdriving.user.core.common.annotion.Permission; |
| | | import com.agentdriving.user.core.common.constant.Const; |
| | | import com.agentdriving.user.core.common.constant.factory.PageFactory; |
| | | import com.baomidou.mybatisplus.mapper.SqlRunner; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.agentdriving.user.modular.system.model.LoginLog; |
| | | import com.agentdriving.user.modular.system.service.ILoginLogService; |
| | | import com.agentdriving.user.modular.system.warpper.LogWarpper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 日志管理的控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年4月5日 19:45:36 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/loginLog") |
| | | public class LoginLogController extends BaseController { |
| | | |
| | | private static String PREFIX = "/system/log/"; |
| | | |
| | | @Autowired |
| | | private ILoginLogService loginLogService; |
| | | |
| | | /** |
| | | * 跳转到日志管理的首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "login_log.html"; |
| | | } |
| | | |
| | | /** |
| | | * 查询登录日志列表 |
| | | */ |
| | | @RequestMapping("/list") |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Object list(@RequestParam(required = false) String beginTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String logName) { |
| | | Page<LoginLog> page = new PageFactory<LoginLog>().defaultPage(); |
| | | List<Map<String, Object>> result = loginLogService.getLoginLogs(page, beginTime, endTime, logName, page.getOrderByField(), page.isAsc()); |
| | | page.setRecords((List<LoginLog>) new LogWarpper(result).warp()); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 清空日志 |
| | | */ |
| | | @BussinessLog("清空登录日志") |
| | | @RequestMapping("/delLoginLog") |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Object delLog() { |
| | | SqlRunner.db().delete("delete from sys_login_log"); |
| | | return SUCCESS_TIP; |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.controller; |
| | | |
| | | import com.agentdriving.user.core.base.controller.BaseController; |
| | | import com.agentdriving.user.core.base.tips.Tip; |
| | | import com.agentdriving.user.core.common.annotion.BussinessLog; |
| | | import com.agentdriving.user.core.common.annotion.Permission; |
| | | import com.agentdriving.user.core.common.constant.Const; |
| | | import com.agentdriving.user.core.common.constant.dictmap.MenuDict; |
| | | import com.agentdriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.agentdriving.user.core.common.constant.state.MenuStatus; |
| | | import com.agentdriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.agentdriving.user.core.exception.GunsException; |
| | | import com.agentdriving.user.core.log.LogObjectHolder; |
| | | import com.agentdriving.user.core.node.ZTreeNode; |
| | | import com.agentdriving.user.core.support.BeanKit; |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.agentdriving.user.modular.system.model.Menu; |
| | | import com.agentdriving.user.modular.system.service.IMenuService; |
| | | import com.agentdriving.user.modular.system.warpper.MenuWarpper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 菜单控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年2月12日21:59:14 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/menu") |
| | | public class MenuController extends BaseController { |
| | | |
| | | private static String PREFIX = "/system/menu/"; |
| | | |
| | | @Autowired |
| | | private IMenuService menuService; |
| | | |
| | | /** |
| | | * 跳转到菜单列表列表页面 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "menu.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到菜单列表列表页面 |
| | | */ |
| | | @RequestMapping(value = "/menu_add") |
| | | public String menuAdd() { |
| | | return PREFIX + "menu_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到菜单详情列表页面 |
| | | */ |
| | | @Permission(Const.ADMIN_NAME) |
| | | @RequestMapping(value = "/menu_edit/{menuId}") |
| | | public String menuEdit(@PathVariable Long menuId, Model model) { |
| | | if (ToolUtil.isEmpty(menuId)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | Menu menu = this.menuService.selectById(menuId); |
| | | |
| | | //获取父级菜单的id |
| | | Menu temp = new Menu(); |
| | | temp.setCode(menu.getPcode()); |
| | | Menu pMenu = this.menuService.selectOne(new EntityWrapper<>(temp)); |
| | | |
| | | //如果父级是顶级菜单 |
| | | if (pMenu == null) { |
| | | menu.setPcode("0"); |
| | | } else { |
| | | //设置父级菜单的code为父级菜单的id |
| | | menu.setPcode(String.valueOf(pMenu.getId())); |
| | | } |
| | | |
| | | Map<String, Object> menuMap = BeanKit.beanToMap(menu); |
| | | menuMap.put("pcodeName", ConstantFactory.me().getMenuNameByCode(temp.getCode())); |
| | | model.addAttribute("menu", menuMap); |
| | | LogObjectHolder.me().set(menu); |
| | | return PREFIX + "menu_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 修该菜单 |
| | | */ |
| | | @Permission(Const.ADMIN_NAME) |
| | | @RequestMapping(value = "/edit") |
| | | @BussinessLog(value = "修改菜单", key = "name", dict = MenuDict.class) |
| | | @ResponseBody |
| | | public Tip edit(@Valid Menu menu, BindingResult result) { |
| | | if (result.hasErrors()) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | //设置父级菜单编号 |
| | | menuSetPcode(menu); |
| | | |
| | | this.menuService.updateById(menu); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 获取菜单列表 |
| | | */ |
| | | @Permission(Const.ADMIN_NAME) |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(@RequestParam(required = false) String menuName, @RequestParam(required = false) String level) { |
| | | List<Map<String, Object>> menus = this.menuService.selectMenus(menuName, level); |
| | | return super.warpObject(new MenuWarpper(menus)); |
| | | } |
| | | |
| | | /** |
| | | * 新增菜单 |
| | | */ |
| | | @Permission(Const.ADMIN_NAME) |
| | | @RequestMapping(value = "/add") |
| | | @BussinessLog(value = "菜单新增", key = "name", dict = MenuDict.class) |
| | | @ResponseBody |
| | | public Tip add(@Valid Menu menu, BindingResult result) { |
| | | if (result.hasErrors()) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | |
| | | //判断是否存在该编号 |
| | | String existedMenuName = ConstantFactory.me().getMenuNameByCode(menu.getCode()); |
| | | if (ToolUtil.isNotEmpty(existedMenuName)) { |
| | | throw new GunsException(BizExceptionEnum.EXISTED_THE_MENU); |
| | | } |
| | | |
| | | //设置父级菜单编号 |
| | | menuSetPcode(menu); |
| | | |
| | | menu.setStatus(MenuStatus.ENABLE.getCode()); |
| | | this.menuService.insert(menu); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除菜单 |
| | | */ |
| | | @Permission(Const.ADMIN_NAME) |
| | | @RequestMapping(value = "/remove") |
| | | @BussinessLog(value = "删除菜单", key = "menuId", dict = MenuDict.class) |
| | | @ResponseBody |
| | | public Tip remove(@RequestParam Long menuId) { |
| | | if (ToolUtil.isEmpty(menuId)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | |
| | | //缓存菜单的名称 |
| | | LogObjectHolder.me().set(ConstantFactory.me().getMenuName(menuId)); |
| | | |
| | | this.menuService.delMenuContainSubMenus(menuId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 查看菜单 |
| | | */ |
| | | @RequestMapping(value = "/view/{menuId}") |
| | | @ResponseBody |
| | | public Tip view(@PathVariable Long menuId) { |
| | | if (ToolUtil.isEmpty(menuId)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | this.menuService.selectById(menuId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 获取菜单列表(首页用) |
| | | */ |
| | | @RequestMapping(value = "/menuTreeList") |
| | | @ResponseBody |
| | | public List<ZTreeNode> menuTreeList() { |
| | | List<ZTreeNode> roleTreeList = this.menuService.menuTreeList(); |
| | | return roleTreeList; |
| | | } |
| | | |
| | | /** |
| | | * 获取菜单列表(选择父级菜单用) |
| | | */ |
| | | @RequestMapping(value = "/selectMenuTreeList") |
| | | @ResponseBody |
| | | public List<ZTreeNode> selectMenuTreeList() { |
| | | List<ZTreeNode> roleTreeList = this.menuService.menuTreeList(); |
| | | roleTreeList.add(ZTreeNode.createParent()); |
| | | return roleTreeList; |
| | | } |
| | | |
| | | /** |
| | | * 获取角色列表 |
| | | */ |
| | | @RequestMapping(value = "/menuTreeListByRoleId/{roleId}") |
| | | @ResponseBody |
| | | public List<ZTreeNode> menuTreeListByRoleId(@PathVariable Integer roleId) { |
| | | List<Long> menuIds = this.menuService.getMenuIdsByRoleId(roleId); |
| | | if (ToolUtil.isEmpty(menuIds)) { |
| | | List<ZTreeNode> roleTreeList = this.menuService.menuTreeList(); |
| | | return roleTreeList; |
| | | } else { |
| | | List<ZTreeNode> roleTreeListByUserId = this.menuService.menuTreeListByMenuIds(menuIds); |
| | | return roleTreeListByUserId; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据请求的父级菜单编号设置pcode和层级 |
| | | */ |
| | | private void menuSetPcode(@Valid Menu menu) { |
| | | if (ToolUtil.isEmpty(menu.getPcode()) || menu.getPcode().equals("0")) { |
| | | menu.setPcode("0"); |
| | | menu.setPcodes("[0],"); |
| | | menu.setLevels(1); |
| | | } else { |
| | | long code = Long.parseLong(menu.getPcode()); |
| | | Menu pMenu = menuService.selectById(code); |
| | | Integer pLevels = pMenu.getLevels(); |
| | | menu.setPcode(pMenu.getCode()); |
| | | |
| | | //如果编号和父编号一致会导致无限递归 |
| | | if (menu.getCode().equals(menu.getPcode())) { |
| | | throw new GunsException(BizExceptionEnum.MENU_PCODE_COINCIDENCE); |
| | | } |
| | | |
| | | menu.setLevels(pLevels + 1); |
| | | menu.setPcodes(pMenu.getPcodes() + "[" + pMenu.getCode() + "],"); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.controller; |
| | | |
| | | import com.agentdriving.user.core.base.controller.BaseController; |
| | | import com.agentdriving.user.core.common.annotion.BussinessLog; |
| | | import com.agentdriving.user.core.common.constant.dictmap.NoticeMap; |
| | | import com.agentdriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.agentdriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.agentdriving.user.core.exception.GunsException; |
| | | import com.agentdriving.user.core.log.LogObjectHolder; |
| | | import com.agentdriving.user.core.shiro.ShiroKit; |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.agentdriving.user.modular.system.model.Notice; |
| | | import com.agentdriving.user.modular.system.service.INoticeService; |
| | | import com.agentdriving.user.modular.system.warpper.NoticeWrapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 通知控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017-05-09 23:02:21 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/notice") |
| | | public class NoticeController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/notice/"; |
| | | |
| | | @Autowired |
| | | private INoticeService noticeService; |
| | | |
| | | /** |
| | | * 跳转到通知列表首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "notice.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加通知 |
| | | */ |
| | | @RequestMapping("/notice_add") |
| | | public String noticeAdd() { |
| | | return PREFIX + "notice_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改通知 |
| | | */ |
| | | @RequestMapping("/notice_update/{noticeId}") |
| | | public String noticeUpdate(@PathVariable Integer noticeId, Model model) { |
| | | Notice notice = this.noticeService.selectById(noticeId); |
| | | model.addAttribute("notice",notice); |
| | | LogObjectHolder.me().set(notice); |
| | | return PREFIX + "notice_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到首页通知 |
| | | */ |
| | | @RequestMapping("/hello") |
| | | public String hello() { |
| | | List<Map<String, Object>> notices = noticeService.list(null); |
| | | super.setAttr("noticeList",notices); |
| | | return "/blackboard.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取通知列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String condition) { |
| | | List<Map<String, Object>> list = this.noticeService.list(condition); |
| | | return super.warpObject(new NoticeWrapper(list)); |
| | | } |
| | | |
| | | /** |
| | | * 新增通知 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | @BussinessLog(value = "新增通知",key = "title",dict = NoticeMap.class) |
| | | public Object add(Notice notice) { |
| | | if (ToolUtil.isOneEmpty(notice, notice.getTitle(), notice.getContent())) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | notice.setCreater(ShiroKit.getUser().getId()); |
| | | notice.setCreatetime(new Date()); |
| | | notice.insert(); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除通知 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | @BussinessLog(value = "删除通知",key = "noticeId",dict = NoticeMap.class) |
| | | public Object delete(@RequestParam Integer noticeId) { |
| | | |
| | | //缓存通知名称 |
| | | LogObjectHolder.me().set(ConstantFactory.me().getNoticeTitle(noticeId)); |
| | | |
| | | this.noticeService.deleteById(noticeId); |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改通知 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | @BussinessLog(value = "修改通知",key = "title",dict = NoticeMap.class) |
| | | public Object update(Notice notice) { |
| | | if (ToolUtil.isOneEmpty(notice, notice.getId(), notice.getTitle(), notice.getContent())) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | Notice old = this.noticeService.selectById(notice.getId()); |
| | | old.setTitle(notice.getTitle()); |
| | | old.setContent(notice.getContent()); |
| | | old.updateById(); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.controller; |
| | | |
| | | import com.agentdriving.user.core.base.controller.BaseController; |
| | | import com.agentdriving.user.core.base.tips.Tip; |
| | | import com.agentdriving.user.core.cache.CacheKit; |
| | | import com.agentdriving.user.core.common.annotion.BussinessLog; |
| | | import com.agentdriving.user.core.common.annotion.Permission; |
| | | import com.agentdriving.user.core.common.constant.Const; |
| | | import com.agentdriving.user.core.common.constant.cache.Cache; |
| | | import com.agentdriving.user.core.common.constant.dictmap.RoleDict; |
| | | import com.agentdriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.agentdriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.agentdriving.user.core.exception.GunsException; |
| | | import com.agentdriving.user.core.log.LogObjectHolder; |
| | | import com.agentdriving.user.core.node.ZTreeNode; |
| | | import com.agentdriving.user.core.util.Convert; |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.agentdriving.user.modular.system.model.Role; |
| | | import com.agentdriving.user.modular.system.model.User; |
| | | import com.agentdriving.user.modular.system.service.IRoleService; |
| | | import com.agentdriving.user.modular.system.service.IUserService; |
| | | import com.agentdriving.user.modular.system.warpper.RoleWarpper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 角色控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年2月12日21:59:14 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/role") |
| | | public class RoleController extends BaseController { |
| | | |
| | | private static String PREFIX = "/system/role"; |
| | | |
| | | @Autowired |
| | | private IUserService userService; |
| | | |
| | | @Autowired |
| | | private IRoleService roleService; |
| | | |
| | | /** |
| | | * 跳转到角色列表页面 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "/role.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加角色 |
| | | */ |
| | | @RequestMapping(value = "/role_add") |
| | | public String roleAdd() { |
| | | return PREFIX + "/role_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改角色 |
| | | */ |
| | | @Permission |
| | | @RequestMapping(value = "/role_edit/{roleId}") |
| | | public String roleEdit(@PathVariable Integer roleId, Model model) { |
| | | if (ToolUtil.isEmpty(roleId)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | Role role = this.roleService.selectById(roleId); |
| | | model.addAttribute(role); |
| | | model.addAttribute("pName", ConstantFactory.me().getSingleRoleName(role.getPid())); |
| | | model.addAttribute("deptName", ConstantFactory.me().getDeptName(role.getDeptid())); |
| | | LogObjectHolder.me().set(role); |
| | | return PREFIX + "/role_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到角色分配 |
| | | */ |
| | | @Permission |
| | | @RequestMapping(value = "/role_assign/{roleId}") |
| | | public String roleAssign(@PathVariable("roleId") Integer roleId, Model model) { |
| | | if (ToolUtil.isEmpty(roleId)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | model.addAttribute("roleId", roleId); |
| | | model.addAttribute("roleName", ConstantFactory.me().getSingleRoleName(roleId)); |
| | | return PREFIX + "/role_assign.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取角色列表 |
| | | */ |
| | | @Permission |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(@RequestParam(required = false) String roleName) { |
| | | List<Map<String, Object>> roles = this.roleService.selectRoles(super.getPara("roleName")); |
| | | return super.warpObject(new RoleWarpper(roles)); |
| | | } |
| | | |
| | | /** |
| | | * 角色新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @BussinessLog(value = "添加角色", key = "name", dict = RoleDict.class) |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Tip add(@Valid Role role, BindingResult result) { |
| | | if (result.hasErrors()) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | role.setId(null); |
| | | this.roleService.insert(role); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 角色修改 |
| | | */ |
| | | @RequestMapping(value = "/edit") |
| | | @BussinessLog(value = "修改角色", key = "name", dict = RoleDict.class) |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Tip edit(@Valid Role role, BindingResult result) { |
| | | if (result.hasErrors()) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | this.roleService.updateById(role); |
| | | |
| | | //删除缓存 |
| | | CacheKit.removeAll(Cache.CONSTANT); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 删除角色 |
| | | */ |
| | | @RequestMapping(value = "/remove") |
| | | @BussinessLog(value = "删除角色", key = "roleId", dict = RoleDict.class) |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Tip remove(@RequestParam Integer roleId) { |
| | | if (ToolUtil.isEmpty(roleId)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | |
| | | //不能删除超级管理员角色 |
| | | if (roleId.equals(Const.ADMIN_ROLE_ID)) { |
| | | throw new GunsException(BizExceptionEnum.CANT_DELETE_ADMIN); |
| | | } |
| | | |
| | | //缓存被删除的角色名称 |
| | | LogObjectHolder.me().set(ConstantFactory.me().getSingleRoleName(roleId)); |
| | | |
| | | this.roleService.delRoleById(roleId); |
| | | |
| | | //删除缓存 |
| | | CacheKit.removeAll(Cache.CONSTANT); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 查看角色 |
| | | */ |
| | | @RequestMapping(value = "/view/{roleId}") |
| | | @ResponseBody |
| | | public Tip view(@PathVariable Integer roleId) { |
| | | if (ToolUtil.isEmpty(roleId)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | this.roleService.selectById(roleId); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 配置权限 |
| | | */ |
| | | @RequestMapping("/setAuthority") |
| | | @BussinessLog(value = "配置权限", key = "roleId,ids", dict = RoleDict.class) |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Tip setAuthority(@RequestParam("roleId") Integer roleId, @RequestParam("ids") String ids) { |
| | | if (ToolUtil.isOneEmpty(roleId)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | this.roleService.setAuthority(roleId, ids); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 获取角色列表 |
| | | */ |
| | | @RequestMapping(value = "/roleTreeList") |
| | | @ResponseBody |
| | | public List<ZTreeNode> roleTreeList() { |
| | | List<ZTreeNode> roleTreeList = this.roleService.roleTreeList(); |
| | | roleTreeList.add(ZTreeNode.createParent()); |
| | | return roleTreeList; |
| | | } |
| | | |
| | | /** |
| | | * 获取角色列表 |
| | | */ |
| | | @RequestMapping(value = "/roleTreeListByUserId/{userId}") |
| | | @ResponseBody |
| | | public List<ZTreeNode> roleTreeListByUserId(@PathVariable Integer userId) { |
| | | User theUser = this.userService.selectById(userId); |
| | | String roleid = theUser.getRoleid(); |
| | | if (ToolUtil.isEmpty(roleid)) { |
| | | List<ZTreeNode> roleTreeList = this.roleService.roleTreeList(); |
| | | return roleTreeList; |
| | | } else { |
| | | String[] strArray = Convert.toStrArray(",", roleid); |
| | | List<ZTreeNode> roleTreeListByUserId = this.roleService.roleTreeListByRoleId(strArray); |
| | | return roleTreeListByUserId; |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.controller; |
| | | |
| | | import com.agentdriving.user.config.properties.GunsProperties; |
| | | import com.agentdriving.user.core.base.controller.BaseController; |
| | | import com.agentdriving.user.core.base.tips.Tip; |
| | | import com.agentdriving.user.core.common.annotion.BussinessLog; |
| | | import com.agentdriving.user.core.common.annotion.Permission; |
| | | import com.agentdriving.user.core.common.constant.Const; |
| | | import com.agentdriving.user.core.common.constant.dictmap.UserDict; |
| | | import com.agentdriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.agentdriving.user.core.common.constant.state.ManagerStatus; |
| | | import com.agentdriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.agentdriving.user.core.datascope.DataScope; |
| | | import com.agentdriving.user.core.db.Db; |
| | | import com.agentdriving.user.core.exception.GunsException; |
| | | import com.agentdriving.user.core.log.LogObjectHolder; |
| | | import com.agentdriving.user.core.shiro.ShiroKit; |
| | | import com.agentdriving.user.core.shiro.ShiroUser; |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.agentdriving.user.modular.system.dao.UserMapper; |
| | | import com.agentdriving.user.modular.system.factory.UserFactory; |
| | | import com.agentdriving.user.modular.system.model.User; |
| | | import com.agentdriving.user.modular.system.service.IUserService; |
| | | import com.agentdriving.user.modular.system.transfer.UserDto; |
| | | import com.agentdriving.user.modular.system.warpper.UserWarpper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.naming.NoPermissionException; |
| | | import javax.validation.Valid; |
| | | import java.io.File; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * 系统管理员控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年1月11日 下午1:08:17 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/mgr") |
| | | public class UserMgrController extends BaseController { |
| | | |
| | | private static String PREFIX = "/system/user/"; |
| | | |
| | | @Autowired |
| | | private GunsProperties gunsProperties; |
| | | |
| | | @Autowired |
| | | private IUserService userService; |
| | | |
| | | /** |
| | | * 跳转到查看管理员列表的页面 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | return PREFIX + "user.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到查看管理员列表的页面 |
| | | */ |
| | | @RequestMapping("/user_add") |
| | | public String addView() { |
| | | return PREFIX + "user_add.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到角色分配页面 |
| | | */ |
| | | //@RequiresPermissions("/mgr/role_assign") //利用shiro自带的权限检查 |
| | | @Permission |
| | | @RequestMapping("/role_assign/{userId}") |
| | | public String roleAssign(@PathVariable Integer userId, Model model) { |
| | | if (ToolUtil.isEmpty(userId)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | User user = (User) Db.create(UserMapper.class).selectOneByCon("id", userId); |
| | | model.addAttribute("userId", userId); |
| | | model.addAttribute("userAccount", user.getAccount()); |
| | | return PREFIX + "user_roleassign.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到编辑管理员页面 |
| | | */ |
| | | @Permission |
| | | @RequestMapping("/user_edit/{userId}") |
| | | public String userEdit(@PathVariable Integer userId, Model model) { |
| | | if (ToolUtil.isEmpty(userId)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | assertAuth(userId); |
| | | User user = this.userService.selectById(userId); |
| | | model.addAttribute(user); |
| | | model.addAttribute("roleName", ConstantFactory.me().getRoleName(user.getRoleid())); |
| | | model.addAttribute("deptName", ConstantFactory.me().getDeptName(user.getDeptid())); |
| | | LogObjectHolder.me().set(user); |
| | | return PREFIX + "user_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到查看用户详情页面 |
| | | */ |
| | | @RequestMapping("/user_info") |
| | | public String userInfo(Model model) { |
| | | Integer userId = ShiroKit.getUser().getId(); |
| | | if (ToolUtil.isEmpty(userId)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | User user = this.userService.selectById(userId); |
| | | model.addAttribute(user); |
| | | model.addAttribute("roleName", ConstantFactory.me().getRoleName(user.getRoleid())); |
| | | model.addAttribute("deptName", ConstantFactory.me().getDeptName(user.getDeptid())); |
| | | LogObjectHolder.me().set(user); |
| | | return PREFIX + "user_view.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改密码界面 |
| | | */ |
| | | @RequestMapping("/user_chpwd") |
| | | public String chPwd() { |
| | | return PREFIX + "user_chpwd.html"; |
| | | } |
| | | |
| | | /** |
| | | * 修改当前用户的密码 |
| | | */ |
| | | @RequestMapping("/changePwd") |
| | | @ResponseBody |
| | | public Object changePwd(@RequestParam String oldPwd, @RequestParam String newPwd, @RequestParam String rePwd) { |
| | | if (!newPwd.equals(rePwd)) { |
| | | throw new GunsException(BizExceptionEnum.TWO_PWD_NOT_MATCH); |
| | | } |
| | | Integer userId = ShiroKit.getUser().getId(); |
| | | User user = userService.selectById(userId); |
| | | String oldMd5 = ShiroKit.md5(oldPwd, user.getSalt()); |
| | | if (user.getPassword().equals(oldMd5)) { |
| | | String newMd5 = ShiroKit.md5(newPwd, user.getSalt()); |
| | | user.setPassword(newMd5); |
| | | user.updateById(); |
| | | return SUCCESS_TIP; |
| | | } else { |
| | | throw new GunsException(BizExceptionEnum.OLD_PWD_NOT_RIGHT); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询管理员列表 |
| | | */ |
| | | @RequestMapping("/list") |
| | | @Permission |
| | | @ResponseBody |
| | | public Object list(@RequestParam(required = false) String name, @RequestParam(required = false) String beginTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) Integer deptid) { |
| | | if (ShiroKit.isAdmin()) { |
| | | List<Map<String, Object>> users = userService.selectUsers(null, name, beginTime, endTime, deptid); |
| | | return new UserWarpper(users).warp(); |
| | | } else { |
| | | DataScope dataScope = new DataScope(ShiroKit.getDeptDataScope()); |
| | | List<Map<String, Object>> users = userService.selectUsers(dataScope, name, beginTime, endTime, deptid); |
| | | return new UserWarpper(users).warp(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 添加管理员 |
| | | */ |
| | | @RequestMapping("/add") |
| | | @BussinessLog(value = "添加管理员", key = "account", dict = UserDict.class) |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Tip add(@Valid UserDto user, BindingResult result) { |
| | | if (result.hasErrors()) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | |
| | | // 判断账号是否重复 |
| | | User theUser = userService.getByAccount(user.getAccount()); |
| | | if (theUser != null) { |
| | | throw new GunsException(BizExceptionEnum.USER_ALREADY_REG); |
| | | } |
| | | |
| | | // 完善账号信息 |
| | | user.setSalt(ShiroKit.getRandomSalt(5)); |
| | | user.setPassword(ShiroKit.md5(user.getPassword(), user.getSalt())); |
| | | user.setStatus(ManagerStatus.OK.getCode()); |
| | | user.setCreatetime(new Date()); |
| | | |
| | | this.userService.insert(UserFactory.createUser(user)); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改管理员 |
| | | * |
| | | * @throws NoPermissionException |
| | | */ |
| | | @RequestMapping("/edit") |
| | | @BussinessLog(value = "修改管理员", key = "account", dict = UserDict.class) |
| | | @ResponseBody |
| | | public Tip edit(@Valid UserDto user, BindingResult result) throws NoPermissionException { |
| | | if (result.hasErrors()) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | |
| | | User oldUser = userService.selectById(user.getId()); |
| | | |
| | | if (ShiroKit.hasRole(Const.ADMIN_NAME)) { |
| | | this.userService.updateById(UserFactory.editUser(user, oldUser)); |
| | | return SUCCESS_TIP; |
| | | } else { |
| | | assertAuth(user.getId()); |
| | | ShiroUser shiroUser = ShiroKit.getUser(); |
| | | if (shiroUser.getId().equals(user.getId())) { |
| | | this.userService.updateById(UserFactory.editUser(user, oldUser)); |
| | | return SUCCESS_TIP; |
| | | } else { |
| | | throw new GunsException(BizExceptionEnum.NO_PERMITION); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除管理员(逻辑删除) |
| | | */ |
| | | @RequestMapping("/delete") |
| | | @BussinessLog(value = "删除管理员", key = "userId", dict = UserDict.class) |
| | | @Permission |
| | | @ResponseBody |
| | | public Tip delete(@RequestParam Integer userId) { |
| | | if (ToolUtil.isEmpty(userId)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | //不能删除超级管理员 |
| | | if (userId.equals(Const.ADMIN_ID)) { |
| | | throw new GunsException(BizExceptionEnum.CANT_DELETE_ADMIN); |
| | | } |
| | | assertAuth(userId); |
| | | this.userService.setStatus(userId, ManagerStatus.DELETED.getCode()); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 查看管理员详情 |
| | | */ |
| | | @RequestMapping("/view/{userId}") |
| | | @ResponseBody |
| | | public User view(@PathVariable Integer userId) { |
| | | if (ToolUtil.isEmpty(userId)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | assertAuth(userId); |
| | | return this.userService.selectById(userId); |
| | | } |
| | | |
| | | /** |
| | | * 重置管理员的密码 |
| | | */ |
| | | @RequestMapping("/reset") |
| | | @BussinessLog(value = "重置管理员密码", key = "userId", dict = UserDict.class) |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Tip reset(@RequestParam Integer userId) { |
| | | if (ToolUtil.isEmpty(userId)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | assertAuth(userId); |
| | | User user = this.userService.selectById(userId); |
| | | user.setSalt(ShiroKit.getRandomSalt(5)); |
| | | user.setPassword(ShiroKit.md5(Const.DEFAULT_PWD, user.getSalt())); |
| | | this.userService.updateById(user); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 冻结用户 |
| | | */ |
| | | @RequestMapping("/freeze") |
| | | @BussinessLog(value = "冻结用户", key = "userId", dict = UserDict.class) |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Tip freeze(@RequestParam Integer userId) { |
| | | if (ToolUtil.isEmpty(userId)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | //不能冻结超级管理员 |
| | | if (userId.equals(Const.ADMIN_ID)) { |
| | | throw new GunsException(BizExceptionEnum.CANT_FREEZE_ADMIN); |
| | | } |
| | | assertAuth(userId); |
| | | this.userService.setStatus(userId, ManagerStatus.FREEZED.getCode()); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 解除冻结用户 |
| | | */ |
| | | @RequestMapping("/unfreeze") |
| | | @BussinessLog(value = "解除冻结用户", key = "userId", dict = UserDict.class) |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Tip unfreeze(@RequestParam Integer userId) { |
| | | if (ToolUtil.isEmpty(userId)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | assertAuth(userId); |
| | | this.userService.setStatus(userId, ManagerStatus.OK.getCode()); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 分配角色 |
| | | */ |
| | | @RequestMapping("/setRole") |
| | | @BussinessLog(value = "分配角色", key = "userId,roleIds", dict = UserDict.class) |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Tip setRole(@RequestParam("userId") Integer userId, @RequestParam("roleIds") String roleIds) { |
| | | if (ToolUtil.isOneEmpty(userId, roleIds)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | //不能修改超级管理员 |
| | | if (userId.equals(Const.ADMIN_ID)) { |
| | | throw new GunsException(BizExceptionEnum.CANT_CHANGE_ADMIN); |
| | | } |
| | | assertAuth(userId); |
| | | this.userService.setRoles(userId, roleIds); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 上传图片 |
| | | */ |
| | | @RequestMapping(method = RequestMethod.POST, path = "/upload") |
| | | @ResponseBody |
| | | public String upload(@RequestPart("file") MultipartFile picture) { |
| | | |
| | | String pictureName = UUID.randomUUID().toString() + "." + ToolUtil.getFileSuffix(picture.getOriginalFilename()); |
| | | try { |
| | | String fileSavePath = gunsProperties.getFileUploadPath(); |
| | | picture.transferTo(new File(fileSavePath + pictureName)); |
| | | } catch (Exception e) { |
| | | throw new GunsException(BizExceptionEnum.UPLOAD_ERROR); |
| | | } |
| | | return pictureName; |
| | | } |
| | | |
| | | /** |
| | | * 判断当前登录的用户是否有操作这个用户的权限 |
| | | */ |
| | | private void assertAuth(Integer userId) { |
| | | if (ShiroKit.isAdmin()) { |
| | | return; |
| | | } |
| | | List<Integer> deptDataScope = ShiroKit.getDeptDataScope(); |
| | | User user = this.userService.selectById(userId); |
| | | Integer deptid = user.getDeptid(); |
| | | if (deptDataScope.contains(deptid)) { |
| | | return; |
| | | } else { |
| | | throw new GunsException(BizExceptionEnum.NO_PERMITION); |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.AccountChangeDetail; |
| | | import com.agentdriving.user.modular.system.warpper.BalanceDetailsWarpper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/4 11:33 |
| | | */ |
| | | public interface AccountChangeDetailMapper extends BaseMapper<AccountChangeDetail> { |
| | | |
| | | |
| | | /** |
| | | * 获取余额明细 |
| | | * @param uid |
| | | * @param time |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | List<BalanceDetailsWarpper> queryBalanceDetails(@Param("uid") Integer uid, @Param("time") String time, |
| | | @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize); |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.Agent; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/5/6 11:52 |
| | | */ |
| | | public interface AgentMapper extends BaseMapper<Agent> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.AppUser; |
| | | |
| | | public interface AppUserMapper extends BaseMapper<AppUser> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.Bill; |
| | | import com.agentdriving.user.modular.system.warpper.BillWarpper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/24 10:04 |
| | | */ |
| | | public interface BillMapper extends BaseMapper<Bill> { |
| | | |
| | | |
| | | /** |
| | | * 获取开票记录 |
| | | * @param uid |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | List<BillWarpper> queryBillList(@Param("uid") Integer uid, @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize); |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.Broadcast; |
| | | |
| | | public interface BroadcastMapper extends BaseMapper<Broadcast> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.CancelOrder; |
| | | |
| | | public interface CancelOrderMapper extends BaseMapper<CancelOrder> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.Commercial; |
| | | import com.agentdriving.user.modular.system.warpper.CommercialWarpper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface CommercialMapper extends BaseMapper<Commercial> { |
| | | |
| | | |
| | | /** |
| | | * 获取广告列表 |
| | | * @param type 广告类型(1=弹窗广告) |
| | | * @param device 设备(1=小程序,2=司机端) |
| | | * @return |
| | | */ |
| | | List<CommercialWarpper> queryCommercialList(@Param("type") Integer type, @Param("device") Integer device); |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.CommercialUserEject; |
| | | |
| | | public interface CommercialUserEjectMapper extends BaseMapper<CommercialUserEject> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.Complaint; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/24 16:05 |
| | | */ |
| | | public interface ComplaintMapper extends BaseMapper<Complaint> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.Coupon; |
| | | |
| | | public interface CouponMapper extends BaseMapper<Coupon> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.agentdriving.user.core.node.ZTreeNode; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.Dept; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 部门表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | public interface DeptMapper extends BaseMapper<Dept> { |
| | | |
| | | /** |
| | | * 获取ztree的节点列表 |
| | | */ |
| | | List<ZTreeNode> tree(); |
| | | |
| | | /** |
| | | * 获取所有部门列表 |
| | | */ |
| | | List<Map<String, Object>> list(@Param("condition") String condition); |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.Dict; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 字典表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | public interface DictMapper extends BaseMapper<Dict> { |
| | | |
| | | /** |
| | | * 根据编码获取词典列表 |
| | | */ |
| | | List<Dict> selectByCode(@Param("code") String code); |
| | | |
| | | /** |
| | | * 查询字典列表 |
| | | */ |
| | | List<Map<String, Object>> list(@Param("condition") String conditiion); |
| | | |
| | | /** |
| | | * 根据父类编码获取词典列表 |
| | | */ |
| | | List<Dict> selectByParentCode(@Param("code") String code); |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.DivisionRecord; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/5/6 16:41 |
| | | */ |
| | | public interface DivisionRecordMapper extends BaseMapper<DivisionRecord> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.agentdriving.user.modular.system.model.Driver; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | |
| | | public interface DriverMapper extends BaseMapper<Driver> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.DriverWork; |
| | | |
| | | public interface DriverWorkMapper extends BaseMapper<DriverWork> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.Evaluate; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/11 16:58 |
| | | */ |
| | | public interface EvaluateMapper extends BaseMapper<Evaluate> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.Html; |
| | | |
| | | /** |
| | | * @author 39373 |
| | | * @date 2023/2/26 17:29 |
| | | */ |
| | | public interface HtmlMapper extends BaseMapper<Html> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.agentdriving.user.modular.system.model.LoginLog; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 登录记录 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | public interface LoginLogMapper extends BaseMapper<LoginLog> { |
| | | |
| | | /** |
| | | * 获取登录日志 |
| | | */ |
| | | List<Map<String, Object>> getLoginLogs(@Param("page") Page<LoginLog> page, @Param("beginTime") String beginTime, |
| | | @Param("endTime") String endTime, @Param("logName") String logName, @Param("orderByField") String orderByField, @Param("isAsc") boolean isAsc); |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.MainContent; |
| | | |
| | | public interface MainContentMapper extends BaseMapper<MainContent> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.agentdriving.user.core.node.MenuNode; |
| | | import com.agentdriving.user.core.node.ZTreeNode; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.Menu; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 菜单表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | public interface MenuMapper extends BaseMapper<Menu> { |
| | | |
| | | /** |
| | | * 根据条件查询菜单 |
| | | * |
| | | * @return |
| | | * @date 2017年2月12日 下午9:14:34 |
| | | */ |
| | | List<Map<String, Object>> selectMenus(@Param("condition") String condition, @Param("level") String level); |
| | | |
| | | /** |
| | | * 根据条件查询菜单 |
| | | * |
| | | * @return |
| | | * @date 2017年2月12日 下午9:14:34 |
| | | */ |
| | | List<Long> getMenuIdsByRoleId(@Param("roleId") Integer roleId); |
| | | |
| | | /** |
| | | * 获取菜单列表树 |
| | | * |
| | | * @return |
| | | * @date 2017年2月19日 下午1:33:51 |
| | | */ |
| | | List<ZTreeNode> menuTreeList(); |
| | | |
| | | /** |
| | | * 获取菜单列表树 |
| | | * |
| | | * @return |
| | | * @date 2017年2月19日 下午1:33:51 |
| | | */ |
| | | List<ZTreeNode> menuTreeListByMenuIds(List<Long> menuIds); |
| | | |
| | | /** |
| | | * 删除menu关联的relation |
| | | * |
| | | * @param menuId |
| | | * @return |
| | | * @date 2017年2月19日 下午4:10:59 |
| | | */ |
| | | int deleteRelationByMenu(Long menuId); |
| | | |
| | | /** |
| | | * 获取资源url通过角色id |
| | | * |
| | | * @param roleId |
| | | * @return |
| | | * @date 2017年2月19日 下午7:12:38 |
| | | */ |
| | | List<String> getResUrlsByRoleId(Integer roleId); |
| | | |
| | | /** |
| | | * 根据角色获取菜单 |
| | | * |
| | | * @param roleIds |
| | | * @return |
| | | * @date 2017年2月19日 下午10:35:40 |
| | | */ |
| | | List<MenuNode> getMenusByRoleIds(List<Integer> roleIds); |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.Notice; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 通知表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | public interface NoticeMapper extends BaseMapper<Notice> { |
| | | |
| | | /** |
| | | * 获取通知列表 |
| | | */ |
| | | List<Map<String, Object>> list(@Param("condition") String condition); |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.agentdriving.user.modular.system.model.OperationLog; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 操作日志 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | public interface OperationLogMapper extends BaseMapper<OperationLog> { |
| | | |
| | | /** |
| | | * 获取操作日志 |
| | | */ |
| | | List<Map<String, Object>> getOperationLogs(@Param("page") Page<OperationLog> page, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("logName") String logName, @Param("logType") String logType, @Param("orderByField") String orderByField, @Param("isAsc") boolean isAsc); |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.Order; |
| | | import com.agentdriving.user.modular.system.warpper.NotInvoiceOrder; |
| | | import com.agentdriving.user.modular.system.warpper.OrderInfoWarpper; |
| | | import com.agentdriving.user.modular.system.warpper.OrderListWarpper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface OrderMapper extends BaseMapper<Order> { |
| | | |
| | | |
| | | /** |
| | | * 获取订单详情 |
| | | * @param uid |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | OrderInfoWarpper queryOrderInfo(@Param("uid") Integer uid, @Param("orderId") Long orderId); |
| | | |
| | | |
| | | /** |
| | | * 获取乘客行程订单 |
| | | * @param uid |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | List<OrderListWarpper> queryMyOrder(@Param("uid") Integer uid, @Param("pageNum") Integer pageNum, |
| | | @Param("pageSize") Integer pageSize); |
| | | |
| | | |
| | | /** |
| | | * 获取未开票订单 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | List<OrderListWarpper> queryNotInvoiceOrder(@Param("uid") Integer uid, @Param("notInvoiceOrder") NotInvoiceOrder notInvoiceOrder); |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.PlatformRechargeRecord; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/5/6 14:09 |
| | | */ |
| | | public interface PlatformRechargeRecordMapper extends BaseMapper<PlatformRechargeRecord> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.RechargeRecord; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/23 14:55 |
| | | */ |
| | | public interface RechargeRecordMapper extends BaseMapper<RechargeRecord> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.Region; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | public interface RegionMapper extends BaseMapper<Region> { |
| | | |
| | | |
| | | |
| | | Region query(@Param("code") String code); |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.Relation; |
| | | |
| | | /** |
| | | * <p> |
| | | * 角色和菜单关联表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | public interface RelationMapper extends BaseMapper<Relation> { |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.Revenue; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/13 10:03 |
| | | */ |
| | | public interface RevenueMapper extends BaseMapper<Revenue> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.agentdriving.user.core.node.ZTreeNode; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.Role; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 角色表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | public interface RoleMapper extends BaseMapper<Role> { |
| | | |
| | | /** |
| | | * 根据条件查询角色列表 |
| | | * |
| | | * @return |
| | | * @date 2017年2月12日 下午9:14:34 |
| | | */ |
| | | List<Map<String, Object>> selectRoles(@Param("condition") String condition); |
| | | |
| | | /** |
| | | * 删除某个角色的所有权限 |
| | | * |
| | | * @param roleId 角色id |
| | | * @return |
| | | * @date 2017年2月13日 下午7:57:51 |
| | | */ |
| | | int deleteRolesById(@Param("roleId") Integer roleId); |
| | | |
| | | /** |
| | | * 获取角色列表树 |
| | | * |
| | | * @return |
| | | * @date 2017年2月18日 上午10:32:04 |
| | | */ |
| | | List<ZTreeNode> roleTreeList(); |
| | | |
| | | /** |
| | | * 获取角色列表树 |
| | | * |
| | | * @return |
| | | * @date 2017年2月18日 上午10:32:04 |
| | | */ |
| | | List<ZTreeNode> roleTreeListByRoleId(String[] roleId); |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.SystemConfig; |
| | | |
| | | public interface SystemConfigMapper extends BaseMapper<SystemConfig> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.agentdriving.user.core.datascope.DataScope; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.User; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 管理员表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | public interface UserMapper extends BaseMapper<User> { |
| | | |
| | | /** |
| | | * 修改用户状态 |
| | | */ |
| | | int setStatus(@Param("userId") Integer userId, @Param("status") int status); |
| | | |
| | | /** |
| | | * 修改密码 |
| | | */ |
| | | int changePwd(@Param("userId") Integer userId, @Param("pwd") String pwd); |
| | | |
| | | /** |
| | | * 根据条件查询用户列表 |
| | | */ |
| | | List<Map<String, Object>> selectUsers(@Param("dataScope") DataScope dataScope, @Param("name") String name, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("deptid") Integer deptid); |
| | | |
| | | /** |
| | | * 设置用户的角色 |
| | | */ |
| | | int setRoles(@Param("userId") Integer userId, @Param("roleIds") String roleIds); |
| | | |
| | | /** |
| | | * 通过账号获取用户 |
| | | */ |
| | | User getByAccount(@Param("account") String account); |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.Coupon; |
| | | import com.agentdriving.user.modular.system.model.UserToCoupon; |
| | | import com.agentdriving.user.modular.system.warpper.CouponWarpper; |
| | | import com.agentdriving.user.modular.system.warpper.CouponsWarpper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 用户优惠券 |
| | | * @author zhibing.pu |
| | | * @date 2023/3/2 11:44 |
| | | */ |
| | | public interface UserToCouponMapper extends BaseMapper<UserToCoupon> { |
| | | |
| | | |
| | | /** |
| | | * 获取可用优惠券 |
| | | * @param uid |
| | | * @param price |
| | | * @return |
| | | */ |
| | | Coupon queryCoupon(@Param("uid") Integer uid, @Param("price") Double price); |
| | | |
| | | |
| | | /** |
| | | * 获取订单支付页面的可用优惠券列表 |
| | | * @param uid |
| | | * @param price |
| | | * @return |
| | | */ |
| | | List<CouponWarpper> queryPayCouponList(@Param("uid") Integer uid, @Param("price") Double price); |
| | | |
| | | |
| | | /** |
| | | * 获取用户优惠券列表 |
| | | * @param uid |
| | | * @param state |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | List<CouponsWarpper> queryMyCoupons(@Param("uid") Integer uid, @Param("state") Integer state, |
| | | @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize); |
| | | |
| | | |
| | | /** |
| | | * 获取已使用优惠券数量 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | Integer queryUsedCouponNum(@Param("uid") Integer uid); |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.WeatherCity; |
| | | |
| | | public interface WeatherCityMapper extends BaseMapper<WeatherCity> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.agentdriving.user.modular.system.model.YouTuiDriver; |
| | | |
| | | public interface YouTuiDriverMapper extends BaseMapper<YouTuiDriver> { |
| | | } |
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.agentdriving.user.modular.system.dao.AccountChangeDetailMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.AccountChangeDetail"> |
| | | <id column="id" property="id"/> |
| | | <result column="code" property="code"/> |
| | | <result column="userType" property="userType"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="type" property="type"/> |
| | | <result column="changeType" property="changeType"/> |
| | | <result column="oldData" property="oldData"/> |
| | | <result column="newData" property="newData"/> |
| | | <result column="orderId" property="orderId"/> |
| | | <result column="explain" property="explain"/> |
| | | <result column="createTime" property="createTime"/> |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | | <select id="queryBalanceDetails" resultType="com.agentdriving.user.modular.system.warpper.BalanceDetailsWarpper"> |
| | | select |
| | | a.changeType as type, |
| | | a.`explain`, |
| | | b.startAddress, |
| | | b.endAddress, |
| | | UNIX_TIMESTAMP(a.createTime) * 1000 as createTime, |
| | | (a.newData - a.oldData) as amount, |
| | | a.newData as balance |
| | | from t_account_change_detail a |
| | | left join t_order b on (a.orderId = b.id) |
| | | where a.userType = 1 and a.userId = #{uid} |
| | | <if test="null != time and '' != time"> |
| | | and DATE_FORMAT(a.createTime, '%Y年%m月') = #{time} |
| | | </if> |
| | | order by a.createTime desc limit #{pageNum}, #{pageSize} |
| | | </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.agentdriving.user.modular.system.dao.AgentMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Agent"> |
| | | <id column="id" property="id"/> |
| | | <result column="principal" property="principal"/> |
| | | <result column="principalPhone" property="principalPhone"/> |
| | | <result column="email" property="email"/> |
| | | <result column="provinceName" property="provinceName"/> |
| | | <result column="provinceCode" property="provinceCode"/> |
| | | <result column="cityCode" property="cityCode"/> |
| | | <result column="cityName" property="cityName"/> |
| | | <result column="status" property="status"/> |
| | | <result column="createTime" property="createTime"/> |
| | | <result column="bankDeposit" property="bankDeposit"/> |
| | | <result column="bankAccount" property="bankAccount"/> |
| | | <result column="serviceCalls" property="serviceCalls"/> |
| | | </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.agentdriving.user.modular.system.dao.AppUserMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.AppUser"> |
| | | <id column="id" property="id"/> |
| | | <result column="nickname" property="nickname"/> |
| | | <result column="phone" property="phone"/> |
| | | <result column="sex" property="sex"/> |
| | | <result column="avatar" property="avatar"/> |
| | | <result column="openid" property="openid"/> |
| | | <result column="unionid" property="unionid"/> |
| | | <result column="emergencyContact" property="emergencyContact"/> |
| | | <result column="emergencyPhone" property="emergencyPhone"/> |
| | | <result column="accountBalance" property="accountBalance"/> |
| | | <result column="userTagId" property="userTagId"/> |
| | | <result column="status" property="status"/> |
| | | <result column="createTime" property="createTime"/> |
| | | <result column="is_exception" property="isException"/> |
| | | <result column="remark" property="remark"/> |
| | | <result column="inviterType" property="inviterType"/> |
| | | <result column="inviterId" property="inviterId"/> |
| | | <result column="cancelCount" property="cancelCount"/> |
| | | <result column="havDiscount" property="havDiscount"/> |
| | | </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.agentdriving.user.modular.system.dao.BillMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Bill"> |
| | | <id column="id" property="id"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="orderId" property="orderId"/> |
| | | <result column="billType" property="billType"/> |
| | | <result column="billHeaderType" property="billHeaderType"/> |
| | | <result column="companyName" property="companyName"/> |
| | | <result column="companyTaxNumber" property="companyTaxNumber"/> |
| | | <result column="billContent" property="billContent"/> |
| | | <result column="moreContent" property="moreContent"/> |
| | | <result column="billAmount" property="billAmount"/> |
| | | <result column="addresseeName" property="addresseeName"/> |
| | | <result column="addresseePhone" property="addresseePhone"/> |
| | | <result column="addresseeEmail" property="addresseeEmail"/> |
| | | <result column="state" property="state"/> |
| | | <result column="createTime" property="createTime"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="queryBillList" resultType="com.agentdriving.user.modular.system.warpper.BillWarpper"> |
| | | select |
| | | id, |
| | | billType, |
| | | billContent, |
| | | billAmount, |
| | | state, |
| | | UNIX_TIMESTAMP(createTime) * 1000 as createTime |
| | | from t_bill where userId = #{uid} order by createTime desc limit #{pageNum}, #{pageSize} |
| | | </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.agentdriving.user.modular.system.dao.BroadcastMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Broadcast"> |
| | | <id column="id" property="id"/> |
| | | <result column="content" property="content"/> |
| | | <result column="sort" property="sort"/> |
| | | <result column="status" property="status"/> |
| | | <result column="createTime" property="createTime"/> |
| | | </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.agentdriving.user.modular.system.dao.CancelOrderMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.CancelOrder"> |
| | | <id column="id" property="id"/> |
| | | <result column="orderId" property="orderId"/> |
| | | <result column="userType" property="userType"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="cause" property="cause"/> |
| | | <result column="status" property="status"/> |
| | | <result column="createTime" property="createTime"/> |
| | | </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.agentdriving.user.modular.system.dao.CommercialMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Commercial"> |
| | | <id column="id" property="id"/> |
| | | <result column="type" property="type"/> |
| | | <result column="name" property="name"/> |
| | | <result column="device" property="device"/> |
| | | <result column="isJump" property="isJump"/> |
| | | <result column="jumpType" property="jumpType"/> |
| | | <result column="jumpUrl" property="jumpUrl"/> |
| | | <result column="html" property="html"/> |
| | | <result column="sort" property="sort"/> |
| | | <result column="status" property="status"/> |
| | | <result column="createUserId" property="createUserId"/> |
| | | <result column="createTime" property="createTime"/> |
| | | <result column="updateUserId" property="updateUserId"/> |
| | | <result column="updateTime" property="updateTime"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="queryCommercialList" resultType="com.agentdriving.user.modular.system.warpper.CommercialWarpper"> |
| | | select |
| | | `name`, |
| | | url, |
| | | `type`, |
| | | isJump, |
| | | jumpType, |
| | | jumpUrl, |
| | | html |
| | | from t_commercial where status = 1 and onOffLine = 1 |
| | | <if test="null != type"> |
| | | and `type` = #{type} |
| | | </if> |
| | | <if test="null != device"> |
| | | and device = #{device} |
| | | </if> |
| | | order by sort limit 0, 3 |
| | | </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.agentdriving.user.modular.system.dao.CommercialUserEjectMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.CommercialUserEject"> |
| | | <id column="id" property="id"/> |
| | | <result column="userType" property="userType"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="lastDate" property="lastDate"/> |
| | | </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.agentdriving.user.modular.system.dao.ComplaintMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Complaint"> |
| | | <id column="id" property="id"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="orderId" property="orderId"/> |
| | | <result column="driverId" property="driverId"/> |
| | | <result column="reason" property="reason"/> |
| | | <result column="notes" property="notes"/> |
| | | <result column="state" property="state"/> |
| | | <result column="status" property="status"/> |
| | | <result column="createTime" property="createTime"/> |
| | | <result column="auditId" property="auditId"/> |
| | | <result column="auditPersonName" property="auditPersonName"/> |
| | | <result column="auditTime" property="auditTime"/> |
| | | </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.agentdriving.user.modular.system.dao.CouponMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Coupon"> |
| | | <id column="id" property="id"/> |
| | | <result column="agent_id" property="agentId"/> |
| | | <result column="branch_office_id" property="branchOfficeId"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="coupon_name" property="couponName"/> |
| | | <result column="coupon_type" property="couponType"/> |
| | | <result column="coupon_code" property="couponCode"/> |
| | | <result column="coupon_service_type" property="couponServiceType"/> |
| | | <result column="coupon_conditional_amount" property="couponConditionalAmount"/> |
| | | <result column="coupon_preferential_amount" property="couponPreferentialAmount"/> |
| | | <result column="coupon_validity" property="couponValidity"/> |
| | | <result column="coupon_send_quantity" property="couponSendQuantity"/> |
| | | <result column="coupon_state" property="couponState"/> |
| | | <result column="coupon_count" property="couponCount"/> |
| | | <result column="remaining_quantity" property="remainingQuantity"/> |
| | | </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.agentdriving.user.modular.system.dao.DeptMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Dept"> |
| | | <id column="id" property="id"/> |
| | | <result column="num" property="num"/> |
| | | <result column="pid" property="pid"/> |
| | | <result column="pids" property="pids"/> |
| | | <result column="simplename" property="simplename"/> |
| | | <result column="fullname" property="fullname"/> |
| | | <result column="tips" property="tips"/> |
| | | <result column="version" property="version"/> |
| | | </resultMap> |
| | | |
| | | <select id="tree" resultType="com.agentdriving.user.core.node.ZTreeNode"> |
| | | select id,pid as pId,simplename as name, |
| | | ( |
| | | CASE |
| | | WHEN (pId = 0 OR pId IS NULL) THEN |
| | | 'true' |
| | | ELSE |
| | | 'false' |
| | | END |
| | | ) as isOpen from sys_dept |
| | | </select> |
| | | |
| | | <select id="list" resultType="map"> |
| | | select * from sys_dept |
| | | <if test="condition != null and condition != ''"> |
| | | where simplename like CONCAT('%',#{condition},'%') or fullname like CONCAT('%',#{condition},'%') |
| | | </if> |
| | | order by num ASC |
| | | </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.agentdriving.user.modular.system.dao.DictMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Dict"> |
| | | <id column="id" property="id"/> |
| | | <result column="num" property="num"/> |
| | | <result column="pid" property="pid"/> |
| | | <result column="name" property="name"/> |
| | | <result column="code" property="code"/> |
| | | <result column="tips" property="tips"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id, num, pid, name,code,tips |
| | | </sql> |
| | | |
| | | <select id="selectByCode" resultType="dict"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from sys_dict |
| | | where code = #{code} |
| | | </select> |
| | | |
| | | <select id="selectByParentCode" resultType="dict"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from sys_dict |
| | | where pid in(select id from sys_dict where code = #{code}) order by num asc |
| | | </select> |
| | | |
| | | <select id="list" resultType="map"> |
| | | select * from sys_dict |
| | | where pid = 0 |
| | | <if test="condition != null and condition != ''"> |
| | | AND name like CONCAT('%',#{condition},'%') |
| | | </if> |
| | | order by id ASC |
| | | </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.agentdriving.user.modular.system.dao.DivisionRecordMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.DivisionRecord"> |
| | | <id column="id" property="id"/> |
| | | <result column="userType" property="userType"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="orderId" property="orderId"/> |
| | | <result column="merOrderId" property="merOrderId"/> |
| | | <result column="sourceType" property="sourceType"/> |
| | | <result column="amount" property="amount"/> |
| | | <result column="merchantNumber" property="merchantNumber"/> |
| | | <result column="state" property="state"/> |
| | | <result column="payTime" property="payTime"/> |
| | | <result column="createTime" property="createTime"/> |
| | | </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.agentdriving.user.modular.system.dao.DriverMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Driver"> |
| | | <id column="id" property="id"/> |
| | | <result column="code" property="code"/> |
| | | <result column="name" property="name"/> |
| | | <result column="avatar" property="avatar"/> |
| | | <result column="phone" property="phone"/> |
| | | <result column="password" property="password"/> |
| | | <result column="sex" property="sex"/> |
| | | <result column="source" property="source"/> |
| | | <result column="emergencyContact" property="emergencyContact"/> |
| | | <result column="emergencyPhone" property="emergencyPhone"/> |
| | | <result column="driverLicenseNumber" property="driverLicenseNumber"/> |
| | | <result column="driverLicense" property="driverLicense"/> |
| | | <result column="firstCertificateTime" property="firstCertificateTime"/> |
| | | <result column="idcard" property="idcard"/> |
| | | <result column="idcardFront" property="idcardFront"/> |
| | | <result column="idcardBack" property="idcardBack"/> |
| | | <result column="inviterType" property="inviterType"/> |
| | | <result column="inviterId" property="inviterId"/> |
| | | <result column="agentId" property="agentId"/> |
| | | <result column="branchOfficeId" property="branchOfficeId"/> |
| | | <result column="balance" property="balance"/> |
| | | <result column="backgroundBalance" property="backgroundBalance"/> |
| | | <result column="couponBalance" property="couponBalance"/> |
| | | <result column="approvalStatus" property="approvalStatus"/> |
| | | <result column="approvalNotes" property="approvalNotes"/> |
| | | <result column="approvalUserId" property="approvalUserId"/> |
| | | <result column="approvalTime" property="approvalTime"/> |
| | | <result column="serverStatus" property="serverStatus"/> |
| | | <result column="integral" property="integral"/> |
| | | <result column="score" property="score"/> |
| | | <result column="status" property="status"/> |
| | | <result column="remark" property="remark"/> |
| | | <result column="isException" property="isException"/> |
| | | <result column="createTime" property="createTime"/> |
| | | <result column="provinceCode" property="provinceCode"/> |
| | | <result column="provinceName" property="provinceName"/> |
| | | <result column="cityCode" property="cityCode"/> |
| | | <result column="cityName" property="cityName"/> |
| | | <result column="areaCode" property="areaCode"/> |
| | | <result column="areaName" property="areaName"/> |
| | | <result column="commission" property="commission"/> |
| | | <result column="wxCollectionCode" property="wxCollectionCode"/> |
| | | <result column="zfbCollectionCode" property="zfbCollectionCode"/> |
| | | <result column="merchantNumber" property="merchantNumber"/> |
| | | <result column="merchantName" property="merchantName"/> |
| | | <result column="merchantPhone" property="merchantPhone"/> |
| | | <result column="merchantIDCode" property="merchantIDCode"/> |
| | | </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.agentdriving.user.modular.system.dao.DriverWorkMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.DriverWork"> |
| | | <id column="id" property="id"/> |
| | | <result column="driverId" property="driverId"/> |
| | | <result column="workTime" property="workTime"/> |
| | | <result column="offWorkTime" property="offWorkTime"/> |
| | | <result column="onlineTime" property="onlineTime"/> |
| | | <result column="status" property="status"/> |
| | | </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.agentdriving.user.modular.system.dao.EvaluateMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Evaluate"> |
| | | <id column="id" property="id"/> |
| | | <result column="orderId" property="orderId"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="score" property="score"/> |
| | | <result column="evaluate" property="evaluate"/> |
| | | <result column="status" property="status"/> |
| | | <result column="createTime" property="createTime"/> |
| | | </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.agentdriving.user.modular.system.dao.HtmlMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Html"> |
| | | <id column="id" property="id"/> |
| | | <result column="type" property="type"/> |
| | | <result column="html" property="html"/> |
| | | <result column="createTime" property="createTime"/> |
| | | </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.agentdriving.user.modular.system.dao.LoginLogMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.LoginLog"> |
| | | <id column="id" property="id" /> |
| | | <result column="logname" property="logname" /> |
| | | <result column="userid" property="userid" /> |
| | | <result column="createtime" property="createtime" /> |
| | | <result column="succeed" property="succeed" /> |
| | | <result column="message" property="message" /> |
| | | <result column="ip" property="ip" /> |
| | | </resultMap> |
| | | |
| | | <select id="getLoginLogs" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page"> |
| | | select * from sys_login_log where 1 = 1 |
| | | <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> |
| | | and (createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) |
| | | </if> |
| | | <if test="logName != null and logName !=''"> |
| | | and logname like CONCAT('%',#{logName},'%') |
| | | </if> |
| | | <choose> |
| | | <when test="orderByField != null and orderByField !=''"> |
| | | <choose> |
| | | <when test="isAsc == true"> |
| | | order by ${orderByField} ASC |
| | | </when> |
| | | <otherwise> |
| | | order by ${orderByField} DESC |
| | | </otherwise> |
| | | </choose> |
| | | </when> |
| | | <otherwise> |
| | | order by createtime DESC |
| | | </otherwise> |
| | | </choose> |
| | | </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.agentdriving.user.modular.system.dao.MainContentMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.MainContent"> |
| | | <id column="id" property="id" /> |
| | | <result column="type" property="type" /> |
| | | <result column="content" property="content" /> |
| | | <result column="status" property="status" /> |
| | | <result column="createTime" property="createTime" /> |
| | | </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.agentdriving.user.modular.system.dao.MenuMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Menu"> |
| | | <id column="id" property="id" /> |
| | | <result column="code" property="code" /> |
| | | <result column="pcode" property="pcode" /> |
| | | <result column="pcodes" property="pcodes" /> |
| | | <result column="name" property="name" /> |
| | | <result column="icon" property="icon" /> |
| | | <result column="url" property="url" /> |
| | | <result column="num" property="num" /> |
| | | <result column="levels" property="levels" /> |
| | | <result column="ismenu" property="ismenu" /> |
| | | <result column="tips" property="tips" /> |
| | | <result column="status" property="status" /> |
| | | <result column="isopen" property="isopen" /> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id, code, pcode, name, icon, url, num, levels,pcodes, |
| | | tips, status,isopen,ismenu |
| | | </sql> |
| | | |
| | | <select id="selectMenus" resultType="map"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from sys_menu |
| | | where status = 1 |
| | | <if test="condition != null and condition != ''"> |
| | | and (name like CONCAT('%',#{condition},'%') or code like CONCAT('%',#{condition},'%')) |
| | | </if> |
| | | <if test="level != null and level != ''"> |
| | | and levels = #{level} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getMenuIdsByRoleId" resultType="long"> |
| | | select menuid from |
| | | sys_relation where roleid = #{roleId} |
| | | </select> |
| | | |
| | | <select id="menuTreeList" resultType="com.agentdriving.user.core.node.ZTreeNode"> |
| | | SELECT |
| | | m1.id AS id, |
| | | ( |
| | | CASE |
| | | WHEN (m2.id = 0 OR m2.id IS NULL) THEN |
| | | 0 |
| | | ELSE |
| | | m2.id |
| | | END |
| | | ) AS pId, |
| | | m1. NAME |
| | | AS NAME, |
| | | ( |
| | | CASE |
| | | WHEN (m2.id = 0 OR m2.id IS NULL) THEN |
| | | 'true' |
| | | ELSE |
| | | 'false' |
| | | END |
| | | ) as isOpen |
| | | FROM |
| | | sys_menu m1 |
| | | LEFT join sys_menu m2 ON m1.pcode = m2. CODE |
| | | ORDER BY |
| | | m1.id ASC |
| | | </select> |
| | | |
| | | <select id="menuTreeListByMenuIds" resultType="com.agentdriving.user.core.node.ZTreeNode"> |
| | | SELECT |
| | | m1.id AS id, |
| | | ( |
| | | CASE |
| | | WHEN (m2.id = 0 OR m2.id IS NULL) THEN |
| | | 0 |
| | | ELSE |
| | | m2.id |
| | | END |
| | | ) AS pId, |
| | | m1. NAME AS NAME, |
| | | ( |
| | | CASE |
| | | WHEN (m2.id = 0 OR m2.id IS |
| | | NULL) THEN |
| | | 'true' |
| | | ELSE |
| | | 'false' |
| | | END |
| | | ) as isOpen, |
| | | ( |
| | | CASE |
| | | WHEN (m3.ID = 0 OR m3.ID |
| | | IS NULL) THEN |
| | | 'false' |
| | | ELSE |
| | | 'true' |
| | | END |
| | | ) "checked" |
| | | FROM |
| | | sys_menu m1 |
| | | LEFT JOIN |
| | | sys_menu m2 |
| | | ON m1.pcode = m2. CODE |
| | | left join ( |
| | | SELECT |
| | | ID |
| | | FROM |
| | | sys_menu |
| | | WHERE |
| | | ID IN |
| | | <foreach collection="list" index="index" item="i" open="(" |
| | | separator="," close=")"> |
| | | #{i} |
| | | </foreach> |
| | | ) m3 on m1.id = m3.id |
| | | ORDER BY |
| | | m1.id ASC |
| | | </select> |
| | | |
| | | <delete id="deleteRelationByMenu"> |
| | | delete from sys_relation where menuid = #{menuId} |
| | | </delete> |
| | | |
| | | <select id="getResUrlsByRoleId" resultType="string"> |
| | | select url from |
| | | sys_relation rel |
| | | inner join sys_menu m on rel.menuid = m.id |
| | | where rel.roleid = #{roleId} |
| | | </select> |
| | | |
| | | <select id="getMenusByRoleIds" resultType="com.agentdriving.user.core.node.MenuNode"> |
| | | SELECT |
| | | m1.id AS id, |
| | | m1.icon AS icon, |
| | | ( |
| | | CASE |
| | | WHEN (m2.id = 0 OR m2.id IS NULL) THEN |
| | | 0 |
| | | ELSE |
| | | m2.id |
| | | END |
| | | ) AS parentId, |
| | | m1.NAME as name, |
| | | m1.url as url, |
| | | m1.levels as levels, |
| | | m1.ismenu as ismenu, |
| | | m1.num as num |
| | | FROM |
| | | sys_menu m1 |
| | | LEFT join sys_menu m2 ON m1.pcode = m2. CODE |
| | | INNER JOIN ( |
| | | SELECT |
| | | ID |
| | | FROM |
| | | sys_menu |
| | | WHERE |
| | | ID IN ( |
| | | SELECT |
| | | menuid |
| | | FROM |
| | | sys_relation rela |
| | | WHERE |
| | | rela.roleid IN |
| | | <foreach collection="list" index="index" item="i" open="(" separator="," close=")"> |
| | | #{i} |
| | | </foreach> |
| | | ) |
| | | ) m3 ON m1.id = m3.id |
| | | where m1.ismenu = 1 |
| | | order by levels,num asc |
| | | </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.agentdriving.user.modular.system.dao.NoticeMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Notice"> |
| | | <id column="id" property="id"/> |
| | | <result column="title" property="title"/> |
| | | <result column="type" property="type"/> |
| | | <result column="content" property="content"/> |
| | | <result column="createtime" property="createtime"/> |
| | | <result column="creater" property="creater"/> |
| | | </resultMap> |
| | | |
| | | <select id="list" resultType="map"> |
| | | select * from sys_notice |
| | | <if test="condition != null and condition != ''"> |
| | | where title like CONCAT('%',#{condition},'%') or content like CONCAT('%',#{condition},'%') |
| | | </if> |
| | | order by createtime DESC |
| | | </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.agentdriving.user.modular.system.dao.OperationLogMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.OperationLog"> |
| | | <id column="id" property="id" /> |
| | | <result column="logtype" property="logtype" /> |
| | | <result column="logname" property="logname" /> |
| | | <result column="userid" property="userid" /> |
| | | <result column="classname" property="classname" /> |
| | | <result column="method" property="method" /> |
| | | <result column="createtime" property="createtime" /> |
| | | <result column="succeed" property="succeed" /> |
| | | <result column="message" property="message" /> |
| | | </resultMap> |
| | | |
| | | <select id="getOperationLogs" resultType="map"> |
| | | select * from sys_operation_log where 1 = 1 |
| | | <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> |
| | | and (createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) |
| | | </if> |
| | | <if test="logName != null and logName !=''"> |
| | | and logname like CONCAT('%',#{logName},'%') |
| | | </if> |
| | | <if test="logType != null and logType !=''"> |
| | | and logtype like CONCAT('%',#{logType},'%') |
| | | </if> |
| | | <choose> |
| | | <when test="orderByField != null and orderByField !=''"> |
| | | <choose> |
| | | <when test="isAsc == true"> |
| | | order by ${orderByField} ASC |
| | | </when> |
| | | <otherwise> |
| | | order by ${orderByField} DESC |
| | | </otherwise> |
| | | </choose> |
| | | </when> |
| | | <otherwise> |
| | | order by createtime DESC |
| | | </otherwise> |
| | | </choose> |
| | | </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.agentdriving.user.modular.system.dao.OrderMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Order"> |
| | | <id column="id" property="id" /> |
| | | <result column="code" property="code" /> |
| | | <result column="userId" property="userId" /> |
| | | <result column="userPhone" property="userPhone" /> |
| | | <result column="userName" property="userName" /> |
| | | <result column="driverId" property="driverId" /> |
| | | <result column="source" property="source" /> |
| | | <result column="agentId" property="agentId" /> |
| | | <result column="branchOfficeId" property="branchOfficeId" /> |
| | | <result column="orderTakingTime" property="orderTakingTime"/> |
| | | <result column="goToAppointmentPointTime" property="goToAppointmentPointTime"/> |
| | | <result column="arrivalTimeAtTheAppointmentPoint" property="arrivalTimeAtTheAppointmentPoint"/> |
| | | <result column="startTime" property="startTime" /> |
| | | <result column="startAddress" property="startAddress" /> |
| | | <result column="startLat" property="startLat" /> |
| | | <result column="startLng" property="startLng" /> |
| | | <result column="endAddress" property="endAddress" /> |
| | | <result column="endLat" property="endLat" /> |
| | | <result column="endLng" property="endLng" /> |
| | | <result column="boardingTime" property="boardingTime" /> |
| | | <result column="getoffTime" property="getoffTime" /> |
| | | <result column="startDistance" property="startDistance" /> |
| | | <result column="startPrice" property="startPrice" /> |
| | | <result column="overDriveDistance" property="overDriveDistance" /> |
| | | <result column="overDrivePrice" property="overDrivePrice" /> |
| | | <result column="longDistance" property="longDistance" /> |
| | | <result column="longDistancePrice" property="longDistancePrice" /> |
| | | <result column="overLongDistance" property="overLongDistance" /> |
| | | <result column="overLongDistancePrice" property="overLongDistancePrice" /> |
| | | <result column="waitTime" property="waitTime" /> |
| | | <result column="waitTimePrice" property="waitTimePrice" /> |
| | | <result column="outWaitTime" property="outWaitTime" /> |
| | | <result column="outWaitTimePrice" property="outWaitTimePrice" /> |
| | | <result column="badWeatherDistance" property="badWeatherDistance" /> |
| | | <result column="badWeatherPrice" property="badWeatherPrice" /> |
| | | <result column="overBadWeatherDistance" property="overBadWeatherDistance" /> |
| | | <result column="overBadWeatherPrice" property="overBadWeatherPrice" /> |
| | | <result column="weather" property="weather"/> |
| | | <result column="estimatedPrice" property="estimatedPrice" /> |
| | | <result column="estimatedMileage" property="estimatedMileage"/> |
| | | <result column="orderMoney" property="orderMoney" /> |
| | | <result column="actualMileage" property="actualMileage"/> |
| | | <result column="payMoney" property="payMoney" /> |
| | | <result column="discountedPrice" property="discountedPrice" /> |
| | | <result column="couponId" property="couponId" /> |
| | | <result column="discountAmount" property="discountAmount"/> |
| | | <result column="discount" property="discount"/> |
| | | <result column="payType" property="payType" /> |
| | | <result column="payTime" property="payTime" /> |
| | | <result column="orderNo" property="orderNo"/> |
| | | <result column="hallOrder" property="hallOrder"/> |
| | | <result column="startWaitTime" property="startWaitTime"/> |
| | | <result column="state" property="state" /> |
| | | <result column="oldState" property="oldState"/> |
| | | <result column="isInvoice" property="isInvoice"/> |
| | | <result column="status" property="status" /> |
| | | <result column="createTime" property="createTime" /> |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | | <select id="queryOrderInfo" resultType="com.agentdriving.user.modular.system.warpper.OrderInfoWarpper"> |
| | | select |
| | | a.id as orderId, |
| | | a.`code`, |
| | | a.startAddress, |
| | | a.startLat, |
| | | a.startLng, |
| | | a.endAddress, |
| | | a.endLat, |
| | | a.endLng, |
| | | b.id as driverId, |
| | | b.avatar as driverAvatar, |
| | | b.`name` as driverName, |
| | | b.phone as driverPhone, |
| | | b.`code` as driverCode, |
| | | ifnull(DATE_FORMAT(now(), '%Y') - DATE_FORMAT(b.firstCertificateTime, '%Y'), 0) as driverAge, |
| | | (select count(1) from t_order where driverId = b.id and `status` = 1 and state in (107, 108, 109)) as driverNumber, |
| | | b.score as driverScore, |
| | | a.state, |
| | | UNIX_TIMESTAMP(a.createTime) * 1000 as createTime, |
| | | c.score as evaluationScore, |
| | | c.evaluate as evaluationContent |
| | | from t_order a |
| | | left join t_driver b on (a.driverId = b.id) |
| | | left join t_evaluate c on (a.id = c.orderId) |
| | | where a.id = #{orderId} |
| | | </select> |
| | | |
| | | |
| | | <select id="queryMyOrder" resultType="com.agentdriving.user.modular.system.warpper.OrderListWarpper"> |
| | | select |
| | | id, |
| | | '超省新代驾订单' as title, |
| | | startAddress, |
| | | endAddress, |
| | | state, |
| | | UNIX_TIMESTAMP(createTime) * 1000 as createTime |
| | | from t_order |
| | | where `status` = 1 and userId = #{uid} order by createTime desc limit #{pageNum}, #{pageSize} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryNotInvoiceOrder" resultType="com.agentdriving.user.modular.system.warpper.OrderListWarpper"> |
| | | select |
| | | id, |
| | | '超省新代驾' as title, |
| | | startAddress, |
| | | endAddress, |
| | | state, |
| | | UNIX_TIMESTAMP(createTime) * 1000 as createTime, |
| | | payMoney as amount |
| | | from t_order |
| | | where `status` = 1 and isInvoice != 1 and state in (108, 109) and userId = #{uid} |
| | | <if test="null != notInvoiceOrder.startTime and '' != notInvoiceOrder.startTime and null != notInvoiceOrder.endTime and '' != notInvoiceOrder.endTime"> |
| | | and DATE_FORMAT(createTime, '%Y-%m-%d') between #{notInvoiceOrder.startTime} and #{notInvoiceOrder.endTime} |
| | | </if> |
| | | <if test="null != notInvoiceOrder.startAmount and null != notInvoiceOrder.endAmount"> |
| | | and payMoney between #{notInvoiceOrder.startAmount} and #{notInvoiceOrder.endAmount} |
| | | </if> |
| | | order by createTime desc limit #{notInvoiceOrder.pageNum}, #{notInvoiceOrder.pageSize} |
| | | </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.agentdriving.user.modular.system.dao.PlatformRechargeRecordMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.PlatformRechargeRecord"> |
| | | <id column="id" property="id"/> |
| | | <result column="orderId" property="orderId"/> |
| | | <result column="price" property="price"/> |
| | | <result column="orderNumber" property="orderNumber"/> |
| | | <result column="balance" property="balance"/> |
| | | <result column="state" property="state"/> |
| | | <result column="payTime" property="payTime"/> |
| | | <result column="createTime" property="createTime"/> |
| | | </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.agentdriving.user.modular.system.dao.RechargeRecordMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.RechargeRecord"> |
| | | <id column="id" property="id" /> |
| | | <result column="type" property="type" /> |
| | | <result column="userId" property="userId" /> |
| | | <result column="code" property="code" /> |
| | | <result column="amount" property="amount"/> |
| | | <result column="payType" property="payType" /> |
| | | <result column="payTime" property="payTime" /> |
| | | <result column="payStatus" property="payStatus" /> |
| | | <result column="orderNumber" property="orderNumber" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="agentId" property="agentId" /> |
| | | </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.agentdriving.user.modular.system.dao.RegionMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Region"> |
| | | <id column="id" property="id" /> |
| | | <result column="name" property="name" /> |
| | | <result column="code" property="code" /> |
| | | <result column="citycode" property="citycode" /> |
| | | <result column="parent_id" property="parentId" /> |
| | | <result column="english" property="english" /> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="query" resultType="Region"> |
| | | select |
| | | id as id, |
| | | name as name, |
| | | code as code, |
| | | citycode as citycode, |
| | | parent_id as parentId, |
| | | english as english |
| | | from t_region where code = #{code} |
| | | </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.agentdriving.user.modular.system.dao.RelationMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Relation"> |
| | | <id column="id" property="id" /> |
| | | <result column="menuid" property="menuid" /> |
| | | <result column="roleid" property="roleid" /> |
| | | </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.agentdriving.user.modular.system.dao.RevenueMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Revenue"> |
| | | <id column="id" property="id"/> |
| | | <result column="type" property="type"/> |
| | | <result column="userType" property="userType"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="orderId" property="orderId"/> |
| | | <result column="amount" property="amount"/> |
| | | <result column="createTime" property="createTime"/> |
| | | </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.agentdriving.user.modular.system.dao.RoleMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.Role"> |
| | | <id column="id" property="id" /> |
| | | <result column="num" property="num" /> |
| | | <result column="pid" property="pid" /> |
| | | <result column="name" property="name" /> |
| | | <result column="deptid" property="deptid" /> |
| | | <result column="tips" property="tips" /> |
| | | <result column="version" property="version" /> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id, num, pid, name, deptid, tips, version |
| | | </sql> |
| | | |
| | | <select id="selectRoles" resultType="map"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from sys_role |
| | | <if test="condition != null"> |
| | | where name like CONCAT('%',#{condition},'%') |
| | | </if> |
| | | </select> |
| | | |
| | | <delete id="deleteRolesById"> |
| | | delete from sys_relation where roleid = #{roleId} |
| | | </delete> |
| | | |
| | | <select id="roleTreeList" resultType="com.agentdriving.user.core.node.ZTreeNode"> |
| | | select id "id",pId |
| | | "pId",name as "name",(case when (pId=0 or pId is null) then 'true' |
| | | else 'false' end) "open" from sys_role |
| | | </select> |
| | | |
| | | <select id="roleTreeListByRoleId" resultType="com.agentdriving.user.core.node.ZTreeNode"> |
| | | SELECT |
| | | r.id "id", |
| | | pId "pId", |
| | | NAME AS "name", |
| | | ( |
| | | CASE |
| | | WHEN (pId = 0 OR pId IS NULL) THEN |
| | | 'true' |
| | | ELSE |
| | | 'false' |
| | | END |
| | | ) "open", |
| | | ( |
| | | CASE |
| | | WHEN (r1.ID = 0 OR r1.ID IS NULL) THEN |
| | | 'false' |
| | | ELSE |
| | | 'true' |
| | | END |
| | | ) "checked" |
| | | FROM |
| | | sys_role r |
| | | LEFT JOIN ( |
| | | SELECT |
| | | ID |
| | | FROM |
| | | sys_role |
| | | WHERE |
| | | ID IN |
| | | |
| | | <foreach collection="array" index="index" item="i" open="(" separator="," close=")"> |
| | | #{i} |
| | | </foreach> |
| | | |
| | | ) r1 ON r.ID = r1.ID |
| | | ORDER BY |
| | | pId, |
| | | num ASC |
| | | </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.agentdriving.user.modular.system.dao.SystemConfigMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.SystemConfig"> |
| | | <id column="id" property="id"/> |
| | | <result column="type" property="type"/> |
| | | <result column="content" property="content"/> |
| | | </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.agentdriving.user.modular.system.dao.UserMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.User"> |
| | | <id column="id" property="id" /> |
| | | <result column="avatar" property="avatar" /> |
| | | <result column="account" property="account" /> |
| | | <result column="password" property="password" /> |
| | | <result column="salt" property="salt" /> |
| | | <result column="name" property="name" /> |
| | | <result column="birthday" property="birthday" /> |
| | | <result column="sex" property="sex" /> |
| | | <result column="email" property="email" /> |
| | | <result column="phone" property="phone" /> |
| | | <result column="roleid" property="roleid" /> |
| | | <result column="deptid" property="deptid" /> |
| | | <result column="status" property="status" /> |
| | | <result column="createtime" property="createtime" /> |
| | | <result column="version" property="version" /> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id, account, name, birthday, sex, email, avatar, |
| | | phone, roleid, |
| | | deptid, status, |
| | | createtime, version |
| | | </sql> |
| | | |
| | | <sql id="Base_Column_List_With_Pwd"> |
| | | id, account, name, birthday,password, sex, email, avatar, |
| | | phone, roleid,salt, |
| | | deptid, status, |
| | | createtime, version |
| | | </sql> |
| | | |
| | | <select id="selectUsers" resultType="map"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from sys_user |
| | | where status != 3 |
| | | <if test="name != null and name != ''"> |
| | | and (phone like CONCAT('%',#{name},'%') |
| | | or account like CONCAT('%',#{name},'%') |
| | | or name like CONCAT('%',#{name},'%')) |
| | | </if> |
| | | <if test="deptid != null and deptid != 0"> |
| | | and (deptid = #{deptid} or deptid in ( select id from sys_dept where pids like CONCAT('%[', #{deptid}, ']%') )) |
| | | </if> |
| | | <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''"> |
| | | and (createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) |
| | | </if> |
| | | </select> |
| | | |
| | | <update id="setStatus"> |
| | | update sys_user set status = #{status} where id = |
| | | #{userId} |
| | | </update> |
| | | |
| | | <update id="changePwd"> |
| | | update sys_user set password = #{pwd} where id = |
| | | #{userId} |
| | | </update> |
| | | |
| | | <update id="setRoles"> |
| | | update sys_user set roleid = #{roleIds} where id = |
| | | #{userId} |
| | | </update> |
| | | |
| | | <select id="getByAccount" resultType="user"> |
| | | select |
| | | <include refid="Base_Column_List_With_Pwd" /> |
| | | from sys_user where account = #{account} and status != 3 |
| | | </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.agentdriving.user.modular.system.dao.UserToCouponMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.UserToCoupon"> |
| | | <id column="id" property="id" /> |
| | | <result column="userId" property="userId" /> |
| | | <result column="couponId" property="couponId" /> |
| | | <result column="couponTotal" property="couponTotal" /> |
| | | <result column="validCount" property="validCount" /> |
| | | <result column="expireCount" property="expireCount" /> |
| | | <result column="expireTime" property="expireTime" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="status" property="status" /> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="queryCoupon" resultType="com.agentdriving.user.modular.system.model.Coupon"> |
| | | select |
| | | b.id, |
| | | a.agent_id as agentId, |
| | | a.branch_office_id as branchOfficeId, |
| | | a.create_time as createTime, |
| | | a.coupon_name as couponName, |
| | | a.coupon_type as couponType, |
| | | a.coupon_code as couponCode, |
| | | a.coupon_service_type as couponServiceType, |
| | | a.coupon_conditional_amount as couponConditionalAmount, |
| | | a.coupon_preferential_amount as couponPreferentialAmount, |
| | | a.coupon_validity as couponValidity, |
| | | a.coupon_send_quantity as couponSendQuantity, |
| | | a.coupon_state as couponState, |
| | | a.coupon_count as couponCount, |
| | | a.remaining_quantity as remainingQuantity |
| | | from t_coupon a |
| | | left join t_user_to_coupon b on (a.id = b.couponId) |
| | | where b.status = 1 and b.expireTime > now() and b.validCount > 0 |
| | | and b.userId = #{uid} and a.coupon_conditional_amount <= #{price} and a.coupon_preferential_amount < #{price} |
| | | order by a.coupon_preferential_amount desc limit 0, 1 |
| | | </select> |
| | | |
| | | |
| | | <select id="queryPayCouponList" resultType="com.agentdriving.user.modular.system.warpper.CouponWarpper"> |
| | | select |
| | | b.id, |
| | | a.coupon_conditional_amount as couponConditionalAmount, |
| | | a.coupon_preferential_amount as couponPreferentialAmount, |
| | | a.coupon_name as couponName, |
| | | UNIX_TIMESTAMP(b.expireTime) * 1000 as expirationDate, |
| | | b.validCount as number |
| | | from t_coupon a |
| | | left join t_user_to_coupon b on (a.id = b.couponId) |
| | | where b.userId = #{uid} and b.validCount > 0 and b.expireTime > now() and |
| | | a.coupon_conditional_amount <= #{price} and a.coupon_preferential_amount < #{price} order by b.createTime |
| | | </select> |
| | | |
| | | |
| | | <select id="queryMyCoupons" resultType="com.agentdriving.user.modular.system.warpper.CouponsWarpper"> |
| | | select |
| | | a.id, |
| | | b.coupon_name as `name`, |
| | | b.coupon_conditional_amount as preferentialTerms, |
| | | b.coupon_preferential_amount as discountAmount, |
| | | UNIX_TIMESTAMP(a.expireTime) * 1000 as endTime |
| | | from t_user_to_coupon a |
| | | left join t_coupon b on (a.couponId = b.id) |
| | | where a.`status` = 1 and a.userId = #{uid} |
| | | <if test="null != state and 1 == state"> |
| | | and a.couponTotal = a.validCount and now() < a.expireTime |
| | | </if> |
| | | <if test="null != state and 2 == state"> |
| | | and a.couponTotal != a.validCount and now() < a.expireTime |
| | | </if> |
| | | <if test="null != state and 3 == state"> |
| | | and now() >= a.expireTime |
| | | </if> |
| | | order by a.createTime desc limit #{pageNum}, #{pageSize} |
| | | </select> |
| | | |
| | | |
| | | <select id="queryUsedCouponNum" resultType="int"> |
| | | select sum(couponTotal - validCount) from t_user_to_coupon where `status` = 1 and userId = #{uid} |
| | | </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.agentdriving.user.modular.system.dao.WeatherCityMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.WeatherCity"> |
| | | <id column="id" property="id" /> |
| | | <result column="province" property="province" /> |
| | | <result column="city" property="city" /> |
| | | <result column="district" property="district" /> |
| | | </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.agentdriving.user.modular.system.dao.YouTuiDriverMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.agentdriving.user.modular.system.model.YouTuiDriver"> |
| | | <id column="id" property="id" /> |
| | | <result column="driverId" property="driverId" /> |
| | | <result column="youTuiId" property="youTuiId" /> |
| | | <result column="integral" property="integral" /> |
| | | <result column="type" property="type"/> |
| | | <result column="surplusQuantity" property="surplusQuantity"/> |
| | | <result column="endTime" property="endTime"/> |
| | | <result column="state" property="state"/> |
| | | <result column="failureTime" property="failureTime" /> |
| | | <result column="createTime" property="createTime" /> |
| | | </resultMap> |
| | | </mapper> |
New file |
| | |
| | | package com.agentdriving.user.modular.system.factory; |
| | | |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.agentdriving.user.modular.system.model.User; |
| | | import com.agentdriving.user.modular.system.transfer.UserDto; |
| | | import org.springframework.beans.BeanUtils; |
| | | |
| | | /** |
| | | * 用户创建工厂 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-05 22:43 |
| | | */ |
| | | public class UserFactory { |
| | | |
| | | public static User createUser(UserDto userDto) { |
| | | if (userDto == null) { |
| | | return null; |
| | | } else { |
| | | User user = new User(); |
| | | BeanUtils.copyProperties(userDto, user); |
| | | return user; |
| | | } |
| | | } |
| | | |
| | | public static User editUser(UserDto newUser, User oldUser) { |
| | | if (newUser == null || oldUser == null) { |
| | | return oldUser; |
| | | } else { |
| | | if (ToolUtil.isNotEmpty(newUser.getAvatar())) { |
| | | oldUser.setAvatar(newUser.getAvatar()); |
| | | } |
| | | if (ToolUtil.isNotEmpty(newUser.getName())) { |
| | | oldUser.setName(newUser.getName()); |
| | | } |
| | | if (ToolUtil.isNotEmpty(newUser.getBirthday())) { |
| | | oldUser.setBirthday(newUser.getBirthday()); |
| | | } |
| | | if (ToolUtil.isNotEmpty(newUser.getDeptid())) { |
| | | oldUser.setDeptid(newUser.getDeptid()); |
| | | } |
| | | if (ToolUtil.isNotEmpty(newUser.getSex())) { |
| | | oldUser.setSex(newUser.getSex()); |
| | | } |
| | | if (ToolUtil.isNotEmpty(newUser.getEmail())) { |
| | | oldUser.setEmail(newUser.getEmail()); |
| | | } |
| | | if (ToolUtil.isNotEmpty(newUser.getPhone())) { |
| | | oldUser.setPhone(newUser.getPhone()); |
| | | } |
| | | return oldUser; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * 账户变动记录 |
| | | * @author zhibing.pu |
| | | * @date 2023/3/4 11:30 |
| | | */ |
| | | @Data |
| | | @TableName("t_account_change_detail") |
| | | public class AccountChangeDetail { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @TableField("code") |
| | | private String code; |
| | | /** |
| | | * 用户类型(1=用户,2=司机) |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 类型(1=余额,2=积分) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 变动类型(1=订单收入,2=订单支出,3=充值,4=提现,5=佣金收入,6=佣金提现,7=优惠券收入,8=保险支付) |
| | | */ |
| | | @TableField("changeType") |
| | | private Integer changeType; |
| | | /** |
| | | * 历史数据 |
| | | */ |
| | | @TableField("oldData") |
| | | private Double oldData; |
| | | /** |
| | | * 新数据 |
| | | */ |
| | | @TableField("newData") |
| | | private Double newData; |
| | | /** |
| | | * 订单id |
| | | */ |
| | | @TableField("orderId") |
| | | private Long orderId; |
| | | /** |
| | | * 变动说明 |
| | | */ |
| | | @TableField("explain") |
| | | private String explain; |
| | | /** |
| | | * 变动时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * 代理商 |
| | | * @author zhibing.pu |
| | | * @date 2023/3/22 22:29 |
| | | */ |
| | | @Data |
| | | @TableName("t_agent") |
| | | public class Agent { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 负责人姓名 |
| | | */ |
| | | @TableField("principal") |
| | | private String principal; |
| | | /** |
| | | * 负责人电话 |
| | | */ |
| | | @TableField("principalPhone") |
| | | private String principalPhone; |
| | | /** |
| | | * 邮箱 |
| | | */ |
| | | @TableField("email") |
| | | private String email; |
| | | /** |
| | | * 代理区域省名称 |
| | | */ |
| | | @TableField("provinceName") |
| | | private String provinceName; |
| | | /** |
| | | * 代理区域省编号 |
| | | */ |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 代理区域市编号 |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 代理区域市名称 |
| | | */ |
| | | @TableField("cityName") |
| | | private String cityName; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | /** |
| | | * 开户银行 |
| | | */ |
| | | @TableField("bankDeposit") |
| | | private String bankDeposit; |
| | | /** |
| | | * 银行账号 |
| | | */ |
| | | @TableField("bankAccount") |
| | | private String bankAccount; |
| | | /** |
| | | * 客服电话 |
| | | */ |
| | | @TableField("serviceCalls") |
| | | private String serviceCalls; |
| | | /** |
| | | * 商户号 |
| | | */ |
| | | @TableField("merchantNumber") |
| | | private String merchantNumber; |
| | | /** |
| | | * 商户姓名 |
| | | */ |
| | | @TableField("merchantName") |
| | | private String merchantName; |
| | | /** |
| | | * 商户电话 |
| | | */ |
| | | @TableField("merchantPhone") |
| | | private String merchantPhone; |
| | | /** |
| | | * 商户身份证号码 |
| | | */ |
| | | @TableField("merchantIDCode") |
| | | private String merchantIDCode; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * 用户 |
| | | */ |
| | | @Data |
| | | @TableName("t_app_user") |
| | | public class AppUser { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 昵称 |
| | | */ |
| | | @TableField("nickname") |
| | | private String nickname; |
| | | /** |
| | | * 电话 |
| | | */ |
| | | @TableField("phone") |
| | | private String phone; |
| | | /** |
| | | * 性别(1=男,2=女) |
| | | */ |
| | | @TableField("sex") |
| | | private Integer sex; |
| | | /** |
| | | * 头像 |
| | | */ |
| | | @TableField("avatar") |
| | | private String avatar; |
| | | /** |
| | | * 微信openid |
| | | */ |
| | | @TableField("openid") |
| | | private String openid; |
| | | /** |
| | | * 微信unionid |
| | | */ |
| | | @TableField("unionid") |
| | | private String unionid; |
| | | /** |
| | | * 紧急联系人 |
| | | */ |
| | | @TableField("emergencyContact") |
| | | private String emergencyContact; |
| | | /** |
| | | * 紧急联系人电话 |
| | | */ |
| | | @TableField("emergencyPhone") |
| | | private String emergencyPhone; |
| | | /** |
| | | * 账户余额 |
| | | */ |
| | | @TableField("accountBalance") |
| | | private Double accountBalance; |
| | | /** |
| | | * 用户标签id |
| | | */ |
| | | @TableField("userTagId") |
| | | private Integer userTagId; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | /** |
| | | * 是否异常 1正常 2异常 |
| | | */ |
| | | @TableField("is_exception") |
| | | private Integer isException; |
| | | /** |
| | | * 启动冻结理由 |
| | | */ |
| | | @TableField("remark") |
| | | private String remark; |
| | | /** |
| | | * 邀约人类型(1=用户,2=司机) |
| | | */ |
| | | @TableField("inviterType") |
| | | private Integer inviterType; |
| | | /** |
| | | * 邀约人id |
| | | */ |
| | | @TableField("inviterId") |
| | | private Integer inviterId; |
| | | /** |
| | | * 取消订单次数,取消一次加一,若成功接单清零 |
| | | */ |
| | | @TableField("cancelCount") |
| | | private Integer cancelCount; |
| | | /** |
| | | * 是否拥有9折优惠 1是 0否 |
| | | */ |
| | | @TableField("havDiscount") |
| | | private Integer havDiscount; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/24 9:59 |
| | | */ |
| | | @Data |
| | | @TableName("t_bill") |
| | | public class Bill { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 订单id |
| | | */ |
| | | @TableField("orderId") |
| | | private Integer orderId; |
| | | /** |
| | | * 发票类型 1电子发票 |
| | | */ |
| | | @TableField("billType") |
| | | private Integer billType; |
| | | /** |
| | | * 发票抬头 1公司 2个人 |
| | | */ |
| | | @TableField("billHeaderType") |
| | | private Integer billHeaderType; |
| | | /** |
| | | * 公司名称/个人抬头名称 |
| | | */ |
| | | @TableField("companyName") |
| | | private String companyName; |
| | | /** |
| | | * 公司税号 |
| | | */ |
| | | @TableField("companyTaxNumber") |
| | | private String companyTaxNumber; |
| | | /** |
| | | * 发票内容 |
| | | */ |
| | | @TableField("billContent") |
| | | private String billContent; |
| | | /** |
| | | * 更多内容 |
| | | */ |
| | | @TableField("moreContent") |
| | | private String moreContent; |
| | | /** |
| | | * 发票金额 |
| | | */ |
| | | @TableField("billAmount") |
| | | private Double billAmount; |
| | | /** |
| | | * 收件人姓名 |
| | | */ |
| | | @TableField("addresseeName") |
| | | private String addresseeName; |
| | | /** |
| | | * 收件人电话 |
| | | */ |
| | | @TableField("addresseePhone") |
| | | private String addresseePhone; |
| | | /** |
| | | * 收件人邮箱 |
| | | */ |
| | | @TableField("addresseeEmail") |
| | | private String addresseeEmail; |
| | | /** |
| | | * 开票状态 1待开票 2已开票 3开票失败 |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * 广播 |
| | | * @author pzb |
| | | * @Date 2023/2/27 17:05 |
| | | */ |
| | | @Data |
| | | @TableName("t_broadcast") |
| | | public class Broadcast { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 消息内容 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * 订单取消记录 |
| | | * @author pzb |
| | | * @Date 2023/2/25 14:37 |
| | | */ |
| | | @Data |
| | | @TableName("t_cancel_order") |
| | | public class CancelOrder { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 订单id |
| | | */ |
| | | @TableField("orderId") |
| | | private Long orderId; |
| | | /** |
| | | * 用户类型(1=用户,2=司机) |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 取消原因 |
| | | */ |
| | | @TableField("cause") |
| | | private String cause; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * 广告实体类 |
| | | */ |
| | | @Data |
| | | @TableName("t_commercial") |
| | | public class Commercial { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 类型(1=弹窗广告,2=底部广告) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 广告名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 设备(1=小程序,2=司机端) |
| | | */ |
| | | @TableField("device") |
| | | private Integer device; |
| | | /** |
| | | * 是否跳转(0=否,1=是) |
| | | */ |
| | | @TableField("isJump") |
| | | private Integer isJump; |
| | | /** |
| | | * 跳转类型(1=内部跳转,2=外部跳转) |
| | | */ |
| | | @TableField("jumpType") |
| | | private Integer jumpType; |
| | | /** |
| | | * 跳转链接 |
| | | */ |
| | | @TableField("jumpUrl") |
| | | private String jumpUrl; |
| | | /** |
| | | * 富文本内容 |
| | | */ |
| | | @TableField("html") |
| | | private String html; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加人员id |
| | | */ |
| | | @TableField("createUserId") |
| | | private Integer createUserId; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | /** |
| | | * 修改人员id |
| | | */ |
| | | @TableField("updateUserId") |
| | | private Integer updateUserId; |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @TableField("updateTime") |
| | | private Date updateTime; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * 用户弹框广告记录 |
| | | */ |
| | | @Data |
| | | @TableName("t_commercial_user_eject") |
| | | public class CommercialUserEject { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | @TableField("id") |
| | | private Long id; |
| | | /** |
| | | * 用户类型(1=用户,2=司机) |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 最后弹出日期 |
| | | */ |
| | | @TableField("lastDate") |
| | | private Date lastDate; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/24 11:58 |
| | | */ |
| | | @Data |
| | | @TableName("t_complaint") |
| | | public class Complaint { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 订单id |
| | | */ |
| | | @TableField("orderId") |
| | | private Integer orderId; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | @TableField("driverId") |
| | | private Integer driverId; |
| | | /** |
| | | * 投诉原因 |
| | | */ |
| | | @TableField("reason") |
| | | private String reason; |
| | | /** |
| | | * 注释 |
| | | */ |
| | | @TableField("notes") |
| | | private String notes; |
| | | /** |
| | | * 处理状态(1=待处理,2=已处理) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | /** |
| | | * 处理人id |
| | | */ |
| | | @TableField("auditId") |
| | | private Integer auditId; |
| | | /** |
| | | * 处理人名称 |
| | | */ |
| | | @TableField("auditPersonName") |
| | | private String auditPersonName; |
| | | /** |
| | | * 处理时间 |
| | | */ |
| | | @TableField("auditTime") |
| | | private Date auditTime; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * 优惠券 |
| | | * @author pzb |
| | | * @Date 2023/2/28 11:57 |
| | | */ |
| | | @Data |
| | | @TableName("t_coupon") |
| | | public class Coupon { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 代理商id |
| | | */ |
| | | @TableField("agent_id") |
| | | private Integer agentId; |
| | | /** |
| | | * 分公司id |
| | | */ |
| | | @TableField("branch_office_id") |
| | | private Integer branchOfficeId; |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField("create_time") |
| | | private Date createTime; |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | @TableField("coupon_name") |
| | | private String couponName; |
| | | /** |
| | | * 优惠券类型 1活动券 2新人券 |
| | | */ |
| | | @TableField("coupon_type") |
| | | private Integer couponType; |
| | | /** |
| | | * 优惠券码 |
| | | */ |
| | | @TableField("coupon_code") |
| | | private String couponCode; |
| | | /** |
| | | * 服务类型 1通用券 |
| | | */ |
| | | @TableField("coupon_service_type") |
| | | private Integer couponServiceType; |
| | | /** |
| | | * 条件金额 |
| | | */ |
| | | @TableField("coupon_conditional_amount") |
| | | private Double couponConditionalAmount; |
| | | /** |
| | | * 优惠金额 |
| | | */ |
| | | @TableField("coupon_preferential_amount") |
| | | private Double couponPreferentialAmount; |
| | | /** |
| | | * 有效期 |
| | | */ |
| | | @TableField("coupon_validity") |
| | | private Integer couponValidity; |
| | | /** |
| | | * 赠送数量 |
| | | */ |
| | | @TableField("coupon_send_quantity") |
| | | private Integer couponSendQuantity; |
| | | /** |
| | | * 是否冻结 1正常 2冻结 |
| | | */ |
| | | @TableField("coupon_state") |
| | | private Integer couponState; |
| | | /** |
| | | * 优惠券数量 |
| | | */ |
| | | @TableField("coupon_count") |
| | | private Integer couponCount; |
| | | /** |
| | | * 剩余数量 |
| | | */ |
| | | @TableField("remaining_quantity") |
| | | private Integer remainingQuantity; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 部门表 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | @TableName("sys_dept") |
| | | public class Dept extends Model<Dept> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键id |
| | | */ |
| | | @TableId(value="id", type= IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | private Integer num; |
| | | /** |
| | | * 父部门id |
| | | */ |
| | | private Integer pid; |
| | | /** |
| | | * 父级ids |
| | | */ |
| | | private String pids; |
| | | /** |
| | | * 简称 |
| | | */ |
| | | private String simplename; |
| | | /** |
| | | * 全称 |
| | | */ |
| | | private String fullname; |
| | | /** |
| | | * 提示 |
| | | */ |
| | | private String tips; |
| | | /** |
| | | * 版本(乐观锁保留字段) |
| | | */ |
| | | private Integer version; |
| | | |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getNum() { |
| | | return num; |
| | | } |
| | | |
| | | public void setNum(Integer num) { |
| | | this.num = num; |
| | | } |
| | | |
| | | public Integer getPid() { |
| | | return pid; |
| | | } |
| | | |
| | | public void setPid(Integer pid) { |
| | | this.pid = pid; |
| | | } |
| | | |
| | | public String getPids() { |
| | | return pids; |
| | | } |
| | | |
| | | public void setPids(String pids) { |
| | | this.pids = pids; |
| | | } |
| | | |
| | | public String getSimplename() { |
| | | return simplename; |
| | | } |
| | | |
| | | public void setSimplename(String simplename) { |
| | | this.simplename = simplename; |
| | | } |
| | | |
| | | public String getFullname() { |
| | | return fullname; |
| | | } |
| | | |
| | | public void setFullname(String fullname) { |
| | | this.fullname = fullname; |
| | | } |
| | | |
| | | public String getTips() { |
| | | return tips; |
| | | } |
| | | |
| | | public void setTips(String tips) { |
| | | this.tips = tips; |
| | | } |
| | | |
| | | public Integer getVersion() { |
| | | return version; |
| | | } |
| | | |
| | | public void setVersion(Integer version) { |
| | | this.version = version; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Dept{" + |
| | | "id=" + id + |
| | | ", num=" + num + |
| | | ", pid=" + pid + |
| | | ", pids=" + pids + |
| | | ", simplename=" + simplename + |
| | | ", fullname=" + fullname + |
| | | ", tips=" + tips + |
| | | ", version=" + version + |
| | | "}"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 字典表 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | @TableName("sys_dict") |
| | | public class Dict extends Model<Dict> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键id |
| | | */ |
| | | @TableId(value="id", type= IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | private Integer num; |
| | | /** |
| | | * 父级字典 |
| | | */ |
| | | private Integer pid; |
| | | /** |
| | | * 名称 |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 编码 |
| | | */ |
| | | private String code; |
| | | /** |
| | | * 提示 |
| | | */ |
| | | private String tips; |
| | | |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getNum() { |
| | | return num; |
| | | } |
| | | |
| | | public void setNum(Integer num) { |
| | | this.num = num; |
| | | } |
| | | |
| | | public Integer getPid() { |
| | | return pid; |
| | | } |
| | | |
| | | public void setPid(Integer pid) { |
| | | this.pid = pid; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getTips() { |
| | | return tips; |
| | | } |
| | | |
| | | public void setTips(String tips) { |
| | | this.tips = tips; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Dict{" + |
| | | "id=" + id + |
| | | ", num=" + num + |
| | | ", pid=" + pid + |
| | | ", name='" + name + '\'' + |
| | | ", code='" + code + '\'' + |
| | | ", tips='" + tips + '\'' + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/5/6 15:54 |
| | | */ |
| | | @Data |
| | | @TableName("t_division_record") |
| | | public class DivisionRecord { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 用户类型(1=司机,2=代理商,3=平台) |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 分账业务订单id |
| | | */ |
| | | @TableField("orderId") |
| | | private Long orderId; |
| | | /** |
| | | * 第三方分账业务订单id |
| | | */ |
| | | @TableField("merOrderId") |
| | | private String merOrderId; |
| | | /** |
| | | * 业务来源(1=订单业务,2=平台充值) |
| | | */ |
| | | @TableField("sourceType") |
| | | private Integer sourceType; |
| | | /** |
| | | * 分账金额 |
| | | */ |
| | | @TableField("amount") |
| | | private Double amount; |
| | | /** |
| | | * 收款商户号 |
| | | */ |
| | | @TableField("merchantNumber") |
| | | private String merchantNumber; |
| | | /** |
| | | * 分账状态(1=分账中,2=分账成功) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 分账时间 |
| | | */ |
| | | @TableField("payTime") |
| | | private Date payTime; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * 司机基础信息 |
| | | * @author pzb |
| | | * @Date 2023/2/8 18:33 |
| | | */ |
| | | @Data |
| | | @TableName("t_driver") |
| | | public class Driver { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @TableField("code") |
| | | private String code; |
| | | /** |
| | | * 名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 头像 |
| | | */ |
| | | @TableField("avatar") |
| | | private String avatar; |
| | | /** |
| | | * 手机号 |
| | | */ |
| | | @TableField("phone") |
| | | private String phone; |
| | | /** |
| | | * 密码 |
| | | */ |
| | | @TableField("password") |
| | | private String password; |
| | | /** |
| | | * 性别(1=男,2=女) |
| | | */ |
| | | @TableField("sex") |
| | | private Integer sex; |
| | | /** |
| | | * 来源 |
| | | */ |
| | | @TableField("source") |
| | | private Integer source; |
| | | /** |
| | | * 紧急联系人 |
| | | */ |
| | | @TableField("emergencyContact") |
| | | private String emergencyContact; |
| | | /** |
| | | * 紧急联系电话 |
| | | */ |
| | | @TableField("emergencyPhone") |
| | | private String emergencyPhone; |
| | | /** |
| | | * 驾驶证号码 |
| | | */ |
| | | @TableField("driverLicenseNumber") |
| | | private String driverLicenseNumber; |
| | | /** |
| | | * 驾驶证照片 |
| | | */ |
| | | @TableField("driverLicense") |
| | | private String driverLicense; |
| | | /** |
| | | * 驾驶证初次领证时间 |
| | | */ |
| | | @TableField("firstCertificateTime") |
| | | private Date firstCertificateTime; |
| | | /** |
| | | * 身份证号码 |
| | | */ |
| | | @TableField("idcard") |
| | | private String idcard; |
| | | /** |
| | | * 身份证正面照 |
| | | */ |
| | | @TableField("idcardFront") |
| | | private String idcardFront; |
| | | /** |
| | | * 身份证背面照 |
| | | */ |
| | | @TableField("idcardBack") |
| | | private String idcardBack; |
| | | /** |
| | | * 邀约人类型(1=用户,2=司机) |
| | | */ |
| | | @TableField("inviterType") |
| | | private Integer inviterType; |
| | | /** |
| | | * 邀约人id |
| | | */ |
| | | @TableField("inviterId") |
| | | private Integer inviterId; |
| | | /** |
| | | * 代理商id |
| | | */ |
| | | @TableField("agentId") |
| | | private Integer agentId; |
| | | /** |
| | | * 分公司id |
| | | */ |
| | | @TableField("branchOfficeId") |
| | | private Integer branchOfficeId; |
| | | /** |
| | | * 账户余额 |
| | | */ |
| | | @TableField("balance") |
| | | private Double balance; |
| | | /** |
| | | * 后台充值余额 |
| | | */ |
| | | @TableField("backgroundBalance") |
| | | private Double backgroundBalance; |
| | | /** |
| | | * 优惠券余额(订单优惠券支付的金额) |
| | | */ |
| | | @TableField("couponBalance") |
| | | private Double couponBalance; |
| | | /** |
| | | * 审核状态(1=待审核,2=已同意,3=已拒绝) |
| | | */ |
| | | @TableField("approvalStatus") |
| | | private Integer approvalStatus; |
| | | /** |
| | | * 审核注释 |
| | | */ |
| | | @TableField("approvalNotes") |
| | | private String approvalNotes; |
| | | /** |
| | | * 审核用户id |
| | | */ |
| | | @TableField("approvalUserId") |
| | | private Integer approvalUserId; |
| | | /** |
| | | * 审核时间 |
| | | */ |
| | | @TableField("approvalTime") |
| | | private Date approvalTime; |
| | | /** |
| | | * 服务状态(1=空闲中,2=服务中) |
| | | */ |
| | | @TableField("serverStatus") |
| | | private Integer serverStatus; |
| | | /** |
| | | * 剩余积分 |
| | | */ |
| | | @TableField("integral") |
| | | private Integer integral; |
| | | /** |
| | | * 评分 |
| | | */ |
| | | @TableField("score") |
| | | private Double score; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 启用冻结理由 |
| | | */ |
| | | @TableField("remark") |
| | | private String remark; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | /** |
| | | * 加盟区域省编号 |
| | | */ |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 加盟区域省名称 |
| | | */ |
| | | @TableField("provinceName") |
| | | private String provinceName; |
| | | /** |
| | | * 加盟区域市编号 |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 加盟区域市名称 |
| | | */ |
| | | @TableField("cityName") |
| | | private String cityName; |
| | | /** |
| | | * 加盟区域区编号 |
| | | */ |
| | | @TableField("areaCode") |
| | | private String areaCode; |
| | | /** |
| | | * 加盟区域区名称 |
| | | */ |
| | | @TableField("areaName") |
| | | private String areaName; |
| | | /** |
| | | * 佣金 |
| | | */ |
| | | @TableField("commission") |
| | | private Double commission; |
| | | /** |
| | | * 微信收款码 |
| | | */ |
| | | @TableField("wxCollectionCode") |
| | | private String wxCollectionCode; |
| | | /** |
| | | * 支付宝收款码 |
| | | */ |
| | | @TableField("zfbCollectionCode") |
| | | private String zfbCollectionCode; |
| | | /** |
| | | * 商户号 |
| | | */ |
| | | @TableField("merchantNumber") |
| | | private String merchantNumber; |
| | | /** |
| | | * 商户姓名 |
| | | */ |
| | | @TableField("merchantName") |
| | | private String merchantName; |
| | | /** |
| | | * 商户电话 |
| | | */ |
| | | @TableField("merchantPhone") |
| | | private String merchantPhone; |
| | | /** |
| | | * 商户身份证号码 |
| | | */ |
| | | @TableField("merchantIDCode") |
| | | private String merchantIDCode; |
| | | /** |
| | | * 是否打开下单二维码 |
| | | */ |
| | | @TableField("openOrderQRCode") |
| | | private Integer openOrderQRCode; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * 司机上下班记录 |
| | | */ |
| | | @Data |
| | | @TableName("t_driver_work") |
| | | public class DriverWork { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | @TableField("driverId") |
| | | private Integer driverId; |
| | | /** |
| | | * 上班时间 |
| | | */ |
| | | @TableField("workTime") |
| | | private Date workTime; |
| | | /** |
| | | * 下班时间 |
| | | */ |
| | | @TableField("offWorkTime") |
| | | private Date offWorkTime; |
| | | /** |
| | | * 在线时长(秒) |
| | | */ |
| | | @TableField("onlineTime") |
| | | private Long onlineTime; |
| | | /** |
| | | * 状态(1=上班,2=下班) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/11 16:51 |
| | | */ |
| | | @Data |
| | | @TableName("t_evaluate") |
| | | public class Evaluate { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 订单id |
| | | */ |
| | | @TableField("orderId") |
| | | private Integer orderId; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 评分 |
| | | */ |
| | | @TableField("score") |
| | | private Integer score; |
| | | /** |
| | | * 评价内容 |
| | | */ |
| | | @TableField("evaluate") |
| | | private String evaluate; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * 协议 |
| | | */ |
| | | @Data |
| | | @TableName("t_html") |
| | | public class Html { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 类型(1=代驾服务协议与隐私政策保护,2=法律条款,3=个人信息处理规则,4=积分说明,5=佣金规则说明,6=行程录音说明,7=预估价格说明,8=加盟基本要求,9=加盟流程,10=起步价说明,11=注销协议,12=关于我们,13=司机消单说明) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * H5内容 |
| | | */ |
| | | @TableField("html") |
| | | private String html; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | 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; |
| | | |
| | | /** |
| | | * <p> |
| | | * 登录记录 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | @TableName("sys_login_log") |
| | | public class LoginLog extends Model<LoginLog> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value="id", type= IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 日志名称 |
| | | */ |
| | | private String logname; |
| | | /** |
| | | * 管理员id |
| | | */ |
| | | private Integer userid; |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createtime; |
| | | /** |
| | | * 是否执行成功 |
| | | */ |
| | | private String succeed; |
| | | /** |
| | | * 具体消息 |
| | | */ |
| | | private String message; |
| | | /** |
| | | * 登录ip |
| | | */ |
| | | private String ip; |
| | | |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getLogname() { |
| | | return logname; |
| | | } |
| | | |
| | | public void setLogname(String logname) { |
| | | this.logname = logname; |
| | | } |
| | | |
| | | public Integer getUserid() { |
| | | return userid; |
| | | } |
| | | |
| | | public void setUserid(Integer userid) { |
| | | this.userid = userid; |
| | | } |
| | | |
| | | public Date getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(Date createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public String getSucceed() { |
| | | return succeed; |
| | | } |
| | | |
| | | public void setSucceed(String succeed) { |
| | | this.succeed = succeed; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | public String getIp() { |
| | | return ip; |
| | | } |
| | | |
| | | public void setIp(String ip) { |
| | | this.ip = ip; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "LoginLog{" + |
| | | "id=" + id + |
| | | ", logname=" + logname + |
| | | ", userid=" + userid + |
| | | ", createtime=" + createtime + |
| | | ", succeed=" + succeed + |
| | | ", message=" + message + |
| | | ", ip=" + ip + |
| | | "}"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * 事由管理 |
| | | * @author pzb |
| | | * @Date 2023/2/27 11:34 |
| | | */ |
| | | @Data |
| | | @TableName("t_main_content") |
| | | public class MainContent { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 数据类型(1=转单,2=司机消单,3=用户取消订单) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 内容 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import org.hibernate.validator.constraints.NotBlank; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 菜单表 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | @TableName("sys_menu") |
| | | public class Menu extends Model<Menu> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | /** |
| | | * 菜单编号 |
| | | */ |
| | | private String code; |
| | | /** |
| | | * 菜单父编号 |
| | | */ |
| | | private String pcode; |
| | | /** |
| | | * 当前菜单的所有父菜单编号 |
| | | */ |
| | | private String pcodes; |
| | | /** |
| | | * 菜单名称 |
| | | */ |
| | | @NotBlank |
| | | private String name; |
| | | /** |
| | | * 菜单图标 |
| | | */ |
| | | private String icon; |
| | | /** |
| | | * url地址 |
| | | */ |
| | | @NotBlank |
| | | private String url; |
| | | /** |
| | | * 菜单排序号 |
| | | */ |
| | | private Integer num; |
| | | /** |
| | | * 菜单层级 |
| | | */ |
| | | private Integer levels; |
| | | /** |
| | | * 是否是菜单(1:是 0:不是) |
| | | */ |
| | | private Integer ismenu; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String tips; |
| | | /** |
| | | * 菜单状态 : 1:启用 0:不启用 |
| | | */ |
| | | private Integer status; |
| | | /** |
| | | * 是否打开: 1:打开 0:不打开 |
| | | */ |
| | | private Integer isopen; |
| | | |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getPcode() { |
| | | return pcode; |
| | | } |
| | | |
| | | public void setPcode(String pcode) { |
| | | this.pcode = pcode; |
| | | } |
| | | |
| | | public String getPcodes() { |
| | | return pcodes; |
| | | } |
| | | |
| | | public void setPcodes(String pcodes) { |
| | | this.pcodes = pcodes; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getIcon() { |
| | | return icon; |
| | | } |
| | | |
| | | public void setIcon(String icon) { |
| | | this.icon = icon; |
| | | } |
| | | |
| | | public String getUrl() { |
| | | return url; |
| | | } |
| | | |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | public Integer getNum() { |
| | | return num; |
| | | } |
| | | |
| | | public void setNum(Integer num) { |
| | | this.num = num; |
| | | } |
| | | |
| | | public Integer getLevels() { |
| | | return levels; |
| | | } |
| | | |
| | | public void setLevels(Integer levels) { |
| | | this.levels = levels; |
| | | } |
| | | |
| | | public Integer getIsmenu() { |
| | | return ismenu; |
| | | } |
| | | |
| | | public void setIsmenu(Integer ismenu) { |
| | | this.ismenu = ismenu; |
| | | } |
| | | |
| | | public String getTips() { |
| | | return tips; |
| | | } |
| | | |
| | | public void setTips(String tips) { |
| | | this.tips = tips; |
| | | } |
| | | |
| | | public Integer getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(Integer status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public Integer getIsopen() { |
| | | return isopen; |
| | | } |
| | | |
| | | public void setIsopen(Integer isopen) { |
| | | this.isopen = isopen; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Menu{" + |
| | | "id=" + id + |
| | | ", code=" + code + |
| | | ", pcode=" + pcode + |
| | | ", pcodes=" + pcodes + |
| | | ", name=" + name + |
| | | ", icon=" + icon + |
| | | ", url=" + url + |
| | | ", num=" + num + |
| | | ", levels=" + levels + |
| | | ", ismenu=" + ismenu + |
| | | ", tips=" + tips + |
| | | ", status=" + status + |
| | | ", isopen=" + isopen + |
| | | "}"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | 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; |
| | | |
| | | /** |
| | | * <p> |
| | | * 通知表 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | @TableName("sys_notice") |
| | | public class Notice extends Model<Notice> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value="id", type= IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 标题 |
| | | */ |
| | | private String title; |
| | | /** |
| | | * 类型 |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 内容 |
| | | */ |
| | | private String content; |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createtime; |
| | | /** |
| | | * 创建人 |
| | | */ |
| | | private Integer creater; |
| | | |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | 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 Date getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(Date createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public Integer getCreater() { |
| | | return creater; |
| | | } |
| | | |
| | | public void setCreater(Integer creater) { |
| | | this.creater = creater; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Notice{" + |
| | | "id=" + id + |
| | | ", title=" + title + |
| | | ", type=" + type + |
| | | ", content=" + content + |
| | | ", createtime=" + createtime + |
| | | ", creater=" + creater + |
| | | "}"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | 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; |
| | | |
| | | /** |
| | | * <p> |
| | | * 操作日志 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | @TableName("sys_operation_log") |
| | | public class OperationLog extends Model<OperationLog> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value="id", type= IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 日志类型 |
| | | */ |
| | | private String logtype; |
| | | /** |
| | | * 日志名称 |
| | | */ |
| | | private String logname; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Integer userid; |
| | | /** |
| | | * 类名称 |
| | | */ |
| | | private String classname; |
| | | /** |
| | | * 方法名称 |
| | | */ |
| | | private String method; |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createtime; |
| | | /** |
| | | * 是否成功 |
| | | */ |
| | | private String succeed; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String message; |
| | | |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getLogtype() { |
| | | return logtype; |
| | | } |
| | | |
| | | public void setLogtype(String logtype) { |
| | | this.logtype = logtype; |
| | | } |
| | | |
| | | public String getLogname() { |
| | | return logname; |
| | | } |
| | | |
| | | public void setLogname(String logname) { |
| | | this.logname = logname; |
| | | } |
| | | |
| | | public Integer getUserid() { |
| | | return userid; |
| | | } |
| | | |
| | | public void setUserid(Integer userid) { |
| | | this.userid = userid; |
| | | } |
| | | |
| | | public String getClassname() { |
| | | return classname; |
| | | } |
| | | |
| | | public void setClassname(String classname) { |
| | | this.classname = classname; |
| | | } |
| | | |
| | | public String getMethod() { |
| | | return method; |
| | | } |
| | | |
| | | public void setMethod(String method) { |
| | | this.method = method; |
| | | } |
| | | |
| | | public Date getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(Date createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public String getSucceed() { |
| | | return succeed; |
| | | } |
| | | |
| | | public void setSucceed(String succeed) { |
| | | this.succeed = succeed; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "OperationLog{" + |
| | | "id=" + id + |
| | | ", logtype=" + logtype + |
| | | ", logname=" + logname + |
| | | ", userid=" + userid + |
| | | ", classname=" + classname + |
| | | ", method=" + method + |
| | | ", createtime=" + createtime + |
| | | ", succeed=" + succeed + |
| | | ", message=" + message + |
| | | "}"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * 订单 |
| | | * @author pzb |
| | | * @Date 2023/2/15 16:59 |
| | | */ |
| | | @Data |
| | | @TableName("t_order") |
| | | public class Order { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Long id; |
| | | /** |
| | | * 订单编号 |
| | | */ |
| | | @TableField("code") |
| | | private String code; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 乘车人电话 |
| | | */ |
| | | @TableField("userPhone") |
| | | private String userPhone; |
| | | /** |
| | | * 乘车人姓名 |
| | | */ |
| | | @TableField("userName") |
| | | private String userName; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | @TableField("driverId") |
| | | private Integer driverId; |
| | | /** |
| | | * 订单来源(1=小程序,2=APP) |
| | | */ |
| | | @TableField("source") |
| | | private Integer source; |
| | | /** |
| | | * 代理商id |
| | | */ |
| | | @TableField("agentId") |
| | | private Integer agentId; |
| | | /** |
| | | * 分公司id |
| | | */ |
| | | @TableField("branchOfficeId") |
| | | private Integer branchOfficeId; |
| | | /** |
| | | * 接单时间 |
| | | */ |
| | | @TableField("orderTakingTime") |
| | | private Date orderTakingTime; |
| | | /** |
| | | * 前往预约点时间 |
| | | */ |
| | | @TableField("goToAppointmentPointTime") |
| | | private Date goToAppointmentPointTime; |
| | | /** |
| | | * 到达预约点时间 |
| | | */ |
| | | @TableField("arrivalTimeAtTheAppointmentPoint") |
| | | private Date arrivalTimeAtTheAppointmentPoint; |
| | | /** |
| | | * 开始服务时间 |
| | | */ |
| | | @TableField("startTime") |
| | | private Date startTime; |
| | | /** |
| | | * 起点地址 |
| | | */ |
| | | @TableField("startAddress") |
| | | private String startAddress; |
| | | /** |
| | | * 起点纬度 |
| | | */ |
| | | @TableField("startLat") |
| | | private String startLat; |
| | | /** |
| | | * 起点经度 |
| | | */ |
| | | @TableField("startLng") |
| | | private String startLng; |
| | | /** |
| | | * 终点地址 |
| | | */ |
| | | @TableField("endAddress") |
| | | private String endAddress; |
| | | /** |
| | | * 终点纬度 |
| | | */ |
| | | @TableField("endLat") |
| | | private String endLat; |
| | | /** |
| | | * 终点经度 |
| | | */ |
| | | @TableField("endLng") |
| | | private String endLng; |
| | | /** |
| | | * 上车时间 |
| | | */ |
| | | @TableField("boardingTime") |
| | | private Date boardingTime; |
| | | /** |
| | | * 下车时间 |
| | | */ |
| | | @TableField("getoffTime") |
| | | private Date getoffTime; |
| | | /** |
| | | * 起步里程 |
| | | */ |
| | | @TableField("startDistance") |
| | | private Double startDistance; |
| | | /** |
| | | * 起步价 |
| | | */ |
| | | @TableField("startPrice") |
| | | private Double startPrice; |
| | | /** |
| | | * 超出起步里程 |
| | | */ |
| | | @TableField("overDriveDistance") |
| | | private Double overDriveDistance; |
| | | /** |
| | | * 超出起步里程费 |
| | | */ |
| | | @TableField("overDrivePrice") |
| | | private Double overDrivePrice; |
| | | /** |
| | | * 长途里程 |
| | | */ |
| | | @TableField("longDistance") |
| | | private String longDistance; |
| | | /** |
| | | * 长途里程费 |
| | | */ |
| | | @TableField("longDistancePrice") |
| | | private Double longDistancePrice; |
| | | /** |
| | | * 超出长途里程 |
| | | */ |
| | | @TableField("overLongDistance") |
| | | private Double overLongDistance; |
| | | /** |
| | | * 超出长途里程费 |
| | | */ |
| | | @TableField("overLongDistancePrice") |
| | | private Double overLongDistancePrice; |
| | | /** |
| | | * 等待时长(分钟) |
| | | */ |
| | | @TableField("waitTime") |
| | | private Integer waitTime; |
| | | /** |
| | | * 等待费 |
| | | */ |
| | | @TableField("waitTimePrice") |
| | | private Double waitTimePrice; |
| | | /** |
| | | * 超出等待时长(分钟) |
| | | */ |
| | | @TableField("outWaitTime") |
| | | private Integer outWaitTime; |
| | | /** |
| | | * 超出等待时长费 |
| | | */ |
| | | @TableField("outWaitTimePrice") |
| | | private Double outWaitTimePrice; |
| | | /** |
| | | * 恶劣天气里程 |
| | | */ |
| | | @TableField("badWeatherDistance") |
| | | private Double badWeatherDistance; |
| | | /** |
| | | * 恶劣天气里程费 |
| | | */ |
| | | @TableField("badWeatherPrice") |
| | | private Double badWeatherPrice; |
| | | /** |
| | | * 恶劣天气超出里程 |
| | | */ |
| | | @TableField("overBadWeatherDistance") |
| | | private Double overBadWeatherDistance; |
| | | /** |
| | | * 恶劣天气超出里程费 |
| | | */ |
| | | @TableField("overBadWeatherPrice") |
| | | private Double overBadWeatherPrice; |
| | | /** |
| | | * 天气 |
| | | */ |
| | | @TableField("weather") |
| | | private String weather; |
| | | /** |
| | | * 预估价 |
| | | */ |
| | | @TableField("estimatedPrice") |
| | | private Double estimatedPrice; |
| | | /** |
| | | * 预估里程 |
| | | */ |
| | | @TableField("estimatedMileage") |
| | | private Double estimatedMileage; |
| | | /** |
| | | * 预估时间 |
| | | */ |
| | | @TableField("estimatedTime") |
| | | private Integer estimatedTime; |
| | | /** |
| | | * 订单金额 |
| | | */ |
| | | @TableField("orderMoney") |
| | | private Double orderMoney; |
| | | /** |
| | | * 实际里程 |
| | | */ |
| | | @TableField("actualMileage") |
| | | private Integer actualMileage; |
| | | /** |
| | | * 支付金额 |
| | | */ |
| | | @TableField("payMoney") |
| | | private Double payMoney; |
| | | /** |
| | | * 优惠金额 |
| | | */ |
| | | @TableField("discountedPrice") |
| | | private Double discountedPrice; |
| | | /** |
| | | * 优惠券id |
| | | */ |
| | | @TableField("couponId") |
| | | private Integer couponId; |
| | | /** |
| | | * 折扣优惠金额 |
| | | */ |
| | | @TableField("discountAmount") |
| | | private Double discountAmount; |
| | | /** |
| | | * 折扣0.01 |
| | | */ |
| | | @TableField("discount") |
| | | private Double discount; |
| | | /** |
| | | * 支付类型(1=微信支付,2=余额支付,3=线下支付) |
| | | */ |
| | | @TableField("payType") |
| | | private Integer payType; |
| | | /** |
| | | * 支付时间 |
| | | */ |
| | | @TableField("payTime") |
| | | private Date payTime; |
| | | /** |
| | | * 第三方支付流水号 |
| | | */ |
| | | @TableField("orderNo") |
| | | private String orderNo; |
| | | /** |
| | | * 大厅订单(0=否,1=是) |
| | | */ |
| | | @TableField("hallOrder") |
| | | private Integer hallOrder; |
| | | /** |
| | | * 订单开始进入等待状态时间 |
| | | */ |
| | | @TableField("startWaitTime") |
| | | private Date startWaitTime; |
| | | /** |
| | | * 订单状态(101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待支付,108=待评价,109=已完成,201=转单中,301=已取消,401=等待中) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 历史订单状态(用于还原之前状态) |
| | | */ |
| | | @TableField("oldState") |
| | | private Integer oldState; |
| | | /** |
| | | * 是否已开发票(0=否,1=是) |
| | | */ |
| | | @TableField("isInvoice") |
| | | private Integer isInvoice; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/5/6 14:05 |
| | | */ |
| | | @Data |
| | | @TableName("t_platform_recharge_record") |
| | | public class PlatformRechargeRecord { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 订单号 |
| | | */ |
| | | @TableField("orderId") |
| | | private String orderId; |
| | | /** |
| | | * 充值金额 |
| | | */ |
| | | @TableField("price") |
| | | private Double price; |
| | | /** |
| | | * 第三方支付流水号 |
| | | */ |
| | | @TableField("orderNumber") |
| | | private String orderNumber; |
| | | /** |
| | | * 余额 |
| | | */ |
| | | @TableField("balance") |
| | | private Double balance; |
| | | /** |
| | | * 支付状态(1=待支付,2=已支付,3=已取消) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 支付时间 |
| | | */ |
| | | @TableField("payTime") |
| | | private Date payTime; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/21 23:08 |
| | | */ |
| | | @Data |
| | | @TableName("t_recharge_record") |
| | | public class RechargeRecord { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 数据类型(1=用户,2=司机,3=代理商) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 流水号 |
| | | */ |
| | | @TableField("code") |
| | | private String code; |
| | | /** |
| | | * 充值金额 |
| | | */ |
| | | @TableField("amount") |
| | | private Double amount; |
| | | /** |
| | | * 未分配金额 |
| | | */ |
| | | @TableField("unallocatedAmount") |
| | | private Double unallocatedAmount; |
| | | /** |
| | | * 支付方式(1=微信,2=系统充值) |
| | | */ |
| | | @TableField("payType") |
| | | private Integer payType; |
| | | /** |
| | | * 完成支付时间 |
| | | */ |
| | | @TableField("payTime") |
| | | private Date payTime; |
| | | /** |
| | | * 支付状态(1=待支付,2=已完成) |
| | | */ |
| | | @TableField("payStatus") |
| | | private Integer payStatus; |
| | | /** |
| | | * 第三方流水号 |
| | | */ |
| | | @TableField("orderNumber") |
| | | private String orderNumber; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | /** |
| | | * 代理商id |
| | | */ |
| | | @TableField("agentId") |
| | | private Integer agentId; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * 省市区 |
| | | */ |
| | | @TableName("t_region") |
| | | public class Region { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 城市名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 城市行政code |
| | | */ |
| | | @TableField("code") |
| | | private String code; |
| | | /** |
| | | * 区号code |
| | | */ |
| | | @TableField("citycode") |
| | | private String citycode; |
| | | /** |
| | | * 父级id |
| | | */ |
| | | @TableField("parent_id") |
| | | private Integer parentId; |
| | | /** |
| | | * 英文 |
| | | */ |
| | | @TableField("english") |
| | | private String english; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getCitycode() { |
| | | return citycode; |
| | | } |
| | | |
| | | public void setCitycode(String citycode) { |
| | | this.citycode = citycode; |
| | | } |
| | | |
| | | public Integer getParentId() { |
| | | return parentId; |
| | | } |
| | | |
| | | public void setParentId(Integer parentId) { |
| | | this.parentId = parentId; |
| | | } |
| | | |
| | | public String getEnglish() { |
| | | return english; |
| | | } |
| | | |
| | | public void setEnglish(String english) { |
| | | this.english = english; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Region{" + |
| | | "id=" + id + |
| | | ", name='" + name + '\'' + |
| | | ", code='" + code + '\'' + |
| | | ", citycode='" + citycode + '\'' + |
| | | ", parentId=" + parentId + |
| | | ", english='" + english + '\'' + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 角色和菜单关联表 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | @TableName("sys_relation") |
| | | public class Relation extends Model<Relation> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 菜单id |
| | | */ |
| | | private Long menuid; |
| | | /** |
| | | * 角色id |
| | | */ |
| | | private Integer roleid; |
| | | |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getMenuid() { |
| | | return menuid; |
| | | } |
| | | |
| | | public void setMenuid(Long menuid) { |
| | | this.menuid = menuid; |
| | | } |
| | | |
| | | public Integer getRoleid() { |
| | | return roleid; |
| | | } |
| | | |
| | | public void setRoleid(Integer roleid) { |
| | | this.roleid = roleid; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Relation{" + |
| | | "id=" + id + |
| | | ", menuid=" + menuid + |
| | | ", roleid=" + roleid + |
| | | "}"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/13 9:58 |
| | | */ |
| | | @Data |
| | | @TableName("t_revenue") |
| | | public class Revenue { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 收入类型(1=订单收入,2=分佣收入) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 用户类型(1=用户,2=司机,3=代理商) |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 订单id |
| | | */ |
| | | @TableField("orderId") |
| | | private Long orderId; |
| | | /** |
| | | * 收入金额 |
| | | */ |
| | | @TableField("amount") |
| | | private Double amount; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 角色表 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | @TableName("sys_role") |
| | | public class Role extends Model<Role> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键id |
| | | */ |
| | | @TableId(value="id", type= IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 序号 |
| | | */ |
| | | private Integer num; |
| | | /** |
| | | * 父角色id |
| | | */ |
| | | private Integer pid; |
| | | /** |
| | | * 角色名称 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 部门名称 |
| | | */ |
| | | private Integer deptid; |
| | | /** |
| | | * 提示 |
| | | */ |
| | | private String tips; |
| | | /** |
| | | * 保留字段(暂时没用) |
| | | */ |
| | | private Integer version; |
| | | |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getNum() { |
| | | return num; |
| | | } |
| | | |
| | | public void setNum(Integer num) { |
| | | this.num = num; |
| | | } |
| | | |
| | | public Integer getPid() { |
| | | return pid; |
| | | } |
| | | |
| | | public void setPid(Integer pid) { |
| | | this.pid = pid; |
| | | } |
| | | |
| | | 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 String getTips() { |
| | | return tips; |
| | | } |
| | | |
| | | public void setTips(String tips) { |
| | | this.tips = tips; |
| | | } |
| | | |
| | | public Integer getVersion() { |
| | | return version; |
| | | } |
| | | |
| | | public void setVersion(Integer version) { |
| | | this.version = version; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Role{" + |
| | | "id=" + id + |
| | | ", num=" + num + |
| | | ", pid=" + pid + |
| | | ", name=" + name + |
| | | ", deptid=" + deptid + |
| | | ", tips=" + tips + |
| | | ", version=" + version + |
| | | "}"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * 系统配置 |
| | | * @author pzb |
| | | * @Date 2023/2/15 16:22 |
| | | */ |
| | | @Data |
| | | @TableName("t_system_config") |
| | | public class SystemConfig { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 类型(1=派单规则,2=佣金分成规则,3=抽成规则,4=积分规则,5=价格规则,6=余额规则,7=客服管理) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 内容 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | 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; |
| | | |
| | | /** |
| | | * <p> |
| | | * 管理员表 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | @TableName("sys_user") |
| | | public class User extends Model<User> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键id |
| | | */ |
| | | @TableId(value="id", type= IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 头像 |
| | | */ |
| | | private String avatar; |
| | | /** |
| | | * 账号 |
| | | */ |
| | | private String account; |
| | | /** |
| | | * 密码 |
| | | */ |
| | | private String password; |
| | | /** |
| | | * md5密码盐 |
| | | */ |
| | | private String salt; |
| | | /** |
| | | * 名字 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 生日 |
| | | */ |
| | | private Date birthday; |
| | | /** |
| | | * 性别(1:男 2:女) |
| | | */ |
| | | private Integer sex; |
| | | /** |
| | | * 电子邮件 |
| | | */ |
| | | private String email; |
| | | /** |
| | | * 电话 |
| | | */ |
| | | private String phone; |
| | | /** |
| | | * 角色id |
| | | */ |
| | | private String roleid; |
| | | /** |
| | | * 部门id |
| | | */ |
| | | private Integer deptid; |
| | | /** |
| | | * 状态(1:启用 2:冻结 3:删除) |
| | | */ |
| | | private Integer status; |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createtime; |
| | | /** |
| | | * 保留字段 |
| | | */ |
| | | private Integer version; |
| | | |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getAvatar() { |
| | | return avatar; |
| | | } |
| | | |
| | | public void setAvatar(String avatar) { |
| | | this.avatar = avatar; |
| | | } |
| | | |
| | | public String getAccount() { |
| | | return account; |
| | | } |
| | | |
| | | public void setAccount(String account) { |
| | | this.account = account; |
| | | } |
| | | |
| | | public String getPassword() { |
| | | return password; |
| | | } |
| | | |
| | | public void setPassword(String password) { |
| | | this.password = password; |
| | | } |
| | | |
| | | public String getSalt() { |
| | | return salt; |
| | | } |
| | | |
| | | public void setSalt(String salt) { |
| | | this.salt = salt; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Date getBirthday() { |
| | | return birthday; |
| | | } |
| | | |
| | | public void setBirthday(Date birthday) { |
| | | this.birthday = birthday; |
| | | } |
| | | |
| | | public Integer getSex() { |
| | | return sex; |
| | | } |
| | | |
| | | public void setSex(Integer sex) { |
| | | this.sex = sex; |
| | | } |
| | | |
| | | public String getEmail() { |
| | | return email; |
| | | } |
| | | |
| | | public void setEmail(String email) { |
| | | this.email = email; |
| | | } |
| | | |
| | | public String getPhone() { |
| | | return phone; |
| | | } |
| | | |
| | | public void setPhone(String phone) { |
| | | this.phone = phone; |
| | | } |
| | | |
| | | public String getRoleid() { |
| | | return roleid; |
| | | } |
| | | |
| | | public void setRoleid(String roleid) { |
| | | this.roleid = roleid; |
| | | } |
| | | |
| | | public Integer getDeptid() { |
| | | return deptid; |
| | | } |
| | | |
| | | public void setDeptid(Integer deptid) { |
| | | this.deptid = deptid; |
| | | } |
| | | |
| | | public Integer getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(Integer status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public Date getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(Date createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public Integer getVersion() { |
| | | return version; |
| | | } |
| | | |
| | | public void setVersion(Integer version) { |
| | | this.version = version; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "User{" + |
| | | "id=" + id + |
| | | ", avatar=" + avatar + |
| | | ", account=" + account + |
| | | ", password=" + password + |
| | | ", salt=" + salt + |
| | | ", name=" + name + |
| | | ", birthday=" + birthday + |
| | | ", sex=" + sex + |
| | | ", email=" + email + |
| | | ", phone=" + phone + |
| | | ", roleid=" + roleid + |
| | | ", deptid=" + deptid + |
| | | ", status=" + status + |
| | | ", createtime=" + createtime + |
| | | ", version=" + version + |
| | | "}"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * 用户优惠券关系 |
| | | * @author pzb |
| | | * @Date 2023/3/2 11:04 |
| | | */ |
| | | @Data |
| | | @TableName("t_user_to_coupon") |
| | | public class UserToCoupon { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 优惠券id |
| | | */ |
| | | @TableField("couponId") |
| | | private Integer couponId; |
| | | /** |
| | | * 领取总数 |
| | | */ |
| | | @TableField("couponTotal") |
| | | private Integer couponTotal; |
| | | /** |
| | | * 有效数据 |
| | | */ |
| | | @TableField("validCount") |
| | | private Integer validCount; |
| | | /** |
| | | * 过期数量 |
| | | */ |
| | | @TableField("expireCount") |
| | | private Integer expireCount; |
| | | /** |
| | | * 过期时间 |
| | | */ |
| | | @TableField("expireTime") |
| | | private Date expireTime; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | /** |
| | | * 状态 1正常 2冻结 3删除 |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * 天气相关城市 |
| | | * @author pzb |
| | | * @Date 2023/2/25 10:56 |
| | | */ |
| | | @Data |
| | | @TableName("t_weather_city") |
| | | public class WeatherCity { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 省 |
| | | */ |
| | | @TableField("province") |
| | | private String province; |
| | | /** |
| | | * 市 |
| | | */ |
| | | @TableField("city") |
| | | private String city; |
| | | /** |
| | | * 区 |
| | | */ |
| | | @TableField("district") |
| | | private String district; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.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; |
| | | |
| | | /** |
| | | * 司机优推数据 |
| | | * @author pzb |
| | | * @Date 2023/2/22 14:01 |
| | | */ |
| | | @Data |
| | | @TableName("t_you_tui_driver") |
| | | public class YouTuiDriver { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | @TableField("driverId") |
| | | private Integer driverId; |
| | | /** |
| | | * 优推id |
| | | */ |
| | | @TableField("youTuiId") |
| | | private Integer youTuiId; |
| | | /** |
| | | * 积分 |
| | | */ |
| | | @TableField("integral") |
| | | private Integer integral; |
| | | /** |
| | | * 优推类型(1=次数,2=小时) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 优推剩余数量 |
| | | */ |
| | | @TableField("surplusQuantity") |
| | | private Integer surplusQuantity; |
| | | /** |
| | | * 优推结束时间 |
| | | */ |
| | | @TableField("endTime") |
| | | private Date endTime; |
| | | /** |
| | | * 状态(1=未使用,2=使用中,3=已结束) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 失效时间 |
| | | */ |
| | | @TableField("failureTime") |
| | | private Date failureTime; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.AccountChangeDetail; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.agentdriving.user.modular.system.warpper.BalanceDetailsWarpper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/4 11:34 |
| | | */ |
| | | public interface IAccountChangeDetailService extends IService<AccountChangeDetail> { |
| | | |
| | | |
| | | /** |
| | | * 保存数据 |
| | | * @param accountChangeDetail |
| | | * @throws Exception |
| | | */ |
| | | void saveData(AccountChangeDetail accountChangeDetail) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取余额明细 |
| | | * @param uid |
| | | * @param time |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<BalanceDetailsWarpper> queryBalanceDetails(Integer uid, String time, Integer pageNum, Integer pageSize) throws Exception; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.Agent; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/5/6 11:53 |
| | | */ |
| | | public interface IAgentService extends IService<Agent> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.AppUser; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.agentdriving.user.modular.system.util.ResultUtil; |
| | | import com.agentdriving.user.modular.system.warpper.CouponsWarpper; |
| | | import com.agentdriving.user.modular.system.warpper.SignInToRegister; |
| | | import com.agentdriving.user.modular.system.warpper.SignInToRegisterWarpper; |
| | | import com.agentdriving.user.modular.system.warpper.UserInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface IAppUserService extends IService<AppUser> { |
| | | |
| | | |
| | | /** |
| | | * 用户登录 |
| | | * @param jscode |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil appUserLogin(String jscode) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 微信授权注册登录 |
| | | * @param signInToRegister |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil<SignInToRegisterWarpper> signInToRegister(SignInToRegister signInToRegister) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 校验token获取用户信息 |
| | | * @return |
| | | */ |
| | | Integer getUserByRequest() throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 修改个人信息 |
| | | * @param userInfo |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil updateUserInfo(Integer uid, UserInfo userInfo) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 余额充值 |
| | | * @param uid |
| | | * @param amount |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil rechargeBalance(Integer uid, Double amount) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 余额充值回调处理 |
| | | * @param out_trade_no |
| | | * @param transaction_id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | void rechargeBalanceCallback(String out_trade_no, String transaction_id) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取用户优惠券列表 |
| | | * @param uid |
| | | * @param state |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<CouponsWarpper> queryMyCoupons(Integer uid, Integer state, Integer pageNum, Integer pageSize) throws Exception; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.Bill; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.agentdriving.user.modular.system.util.ResultUtil; |
| | | import com.agentdriving.user.modular.system.warpper.BillWarpper; |
| | | import com.agentdriving.user.modular.system.warpper.Invoicing; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/24 10:07 |
| | | */ |
| | | public interface IBillService extends IService<Bill> { |
| | | |
| | | |
| | | /** |
| | | * 开票操作 |
| | | * @param uid |
| | | * @param invoicing |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil invoicing(Integer uid, Invoicing invoicing) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取开票记录 |
| | | * @param uid |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<BillWarpper> queryBillList(Integer uid, Integer pageNum, Integer pageSize) throws Exception; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.Broadcast; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | public interface IBroadcastService extends IService<Broadcast> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.CancelOrder; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | public interface ICancelOrderService extends IService<CancelOrder> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.Commercial; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.agentdriving.user.modular.system.warpper.CommercialWarpper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 广告接口 |
| | | */ |
| | | public interface ICommercialService extends IService<Commercial> { |
| | | |
| | | |
| | | /** |
| | | * 获取广告列表数据 |
| | | * @param type 广告类型(1=弹窗广告) |
| | | * @param device 设备(1=小程序,2=司机端) |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<CommercialWarpper> queryCommercialList(Integer uid, Integer type, Integer device) throws Exception; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.CommercialUserEject; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | public interface ICommercialUserEjectService extends IService<CommercialUserEject> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.Complaint; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/24 16:07 |
| | | */ |
| | | public interface IComplaintService extends IService<Complaint> { |
| | | |
| | | |
| | | /** |
| | | * 投诉反馈 |
| | | * @param orderId |
| | | * @param content |
| | | * @throws Exception |
| | | */ |
| | | void feedback(Integer uid, Integer orderId, String content) throws Exception; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.Coupon; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | public interface ICouponService extends IService<Coupon> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.core.node.ZTreeNode; |
| | | import com.agentdriving.user.modular.system.model.Dept; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 部门服务 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-04-27 17:00 |
| | | */ |
| | | public interface IDeptService extends IService<Dept> { |
| | | |
| | | /** |
| | | * 删除部门 |
| | | */ |
| | | void deleteDept(Integer deptId); |
| | | |
| | | /** |
| | | * 获取ztree的节点列表 |
| | | */ |
| | | List<ZTreeNode> tree(); |
| | | |
| | | /** |
| | | * 获取所有部门列表 |
| | | */ |
| | | List<Map<String, Object>> list(@Param("condition") String condition); |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.Dict; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 字典服务 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-04-27 17:00 |
| | | */ |
| | | public interface IDictService extends IService<Dict> { |
| | | |
| | | /** |
| | | * 添加字典 |
| | | */ |
| | | void addDict(String dictCode,String dictName,String dictTips, String dictValues); |
| | | |
| | | /** |
| | | * 编辑字典 |
| | | */ |
| | | void editDict(Integer dictId,String dictCode, String dictName,String dictTips, String dicts); |
| | | |
| | | /** |
| | | * 删除字典 |
| | | */ |
| | | void delteDict(Integer dictId); |
| | | |
| | | /** |
| | | * 根据编码获取词典列表 |
| | | */ |
| | | List<Dict> selectByCode(@Param("code") String code); |
| | | |
| | | /** |
| | | * 根据父类编码获取词典列表 |
| | | */ |
| | | List<Dict> selectByParentCode(@Param("code") String code); |
| | | |
| | | /** |
| | | * 查询字典列表 |
| | | */ |
| | | List<Map<String, Object>> list(@Param("condition") String conditiion); |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.DivisionRecord; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/5/6 16:42 |
| | | */ |
| | | public interface IDivisionRecordService extends IService<DivisionRecord> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.Driver; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.agentdriving.user.modular.system.warpper.NearbyDriverWarpper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 司机 |
| | | * @author pzb |
| | | * @Date 2023/2/8 18:52 |
| | | */ |
| | | public interface IDriverService extends IService<Driver> { |
| | | |
| | | |
| | | /** |
| | | * 获取5公里范围内的司机坐标 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<NearbyDriverWarpper> queryDriverPosition(String lon, String lat, Double scope) throws Exception; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.DriverWork; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | public interface IDriverWorkService extends IService<DriverWork> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.Evaluate; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/11 16:59 |
| | | */ |
| | | public interface IEvaluateService extends IService<Evaluate> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.Html; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | /** |
| | | * @author 39373 |
| | | * @date 2023/2/26 17:30 |
| | | */ |
| | | public interface IHtmlService extends IService<Html> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.LoginLog; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 登录记录 服务类 |
| | | * </p> |
| | | * |
| | | * @author stylefeng123 |
| | | * @since 2018-02-22 |
| | | */ |
| | | public interface ILoginLogService extends IService<LoginLog> { |
| | | |
| | | /** |
| | | * 获取登录日志列表 |
| | | */ |
| | | List<Map<String, Object>> getLoginLogs(Page<LoginLog> page, String beginTime, String endTime, String logName, String orderByField, boolean asc); |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.MainContent; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | public interface IMainContentService extends IService<MainContent> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.core.node.MenuNode; |
| | | import com.agentdriving.user.core.node.ZTreeNode; |
| | | import com.agentdriving.user.modular.system.model.Menu; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 菜单服务 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-05 22:19 |
| | | */ |
| | | public interface IMenuService extends IService<Menu> { |
| | | |
| | | /** |
| | | * 删除菜单 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/5 22:20 |
| | | */ |
| | | void delMenu(Long menuId); |
| | | |
| | | /** |
| | | * 删除菜单包含所有子菜单 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/6/13 22:02 |
| | | */ |
| | | void delMenuContainSubMenus(Long menuId); |
| | | |
| | | /** |
| | | * 根据条件查询菜单 |
| | | * |
| | | * @return |
| | | * @date 2017年2月12日 下午9:14:34 |
| | | */ |
| | | List<Map<String, Object>> selectMenus(@Param("condition") String condition, @Param("level") String level); |
| | | |
| | | /** |
| | | * 根据条件查询菜单 |
| | | * |
| | | * @return |
| | | * @date 2017年2月12日 下午9:14:34 |
| | | */ |
| | | List<Long> getMenuIdsByRoleId(@Param("roleId") Integer roleId); |
| | | |
| | | /** |
| | | * 获取菜单列表树 |
| | | * |
| | | * @return |
| | | * @date 2017年2月19日 下午1:33:51 |
| | | */ |
| | | List<ZTreeNode> menuTreeList(); |
| | | |
| | | /** |
| | | * 获取菜单列表树 |
| | | * |
| | | * @return |
| | | * @date 2017年2月19日 下午1:33:51 |
| | | */ |
| | | List<ZTreeNode> menuTreeListByMenuIds(List<Long> menuIds); |
| | | |
| | | /** |
| | | * 删除menu关联的relation |
| | | * |
| | | * @param menuId |
| | | * @return |
| | | * @date 2017年2月19日 下午4:10:59 |
| | | */ |
| | | int deleteRelationByMenu(Long menuId); |
| | | |
| | | /** |
| | | * 获取资源url通过角色id |
| | | * |
| | | * @param roleId |
| | | * @return |
| | | * @date 2017年2月19日 下午7:12:38 |
| | | */ |
| | | List<String> getResUrlsByRoleId(Integer roleId); |
| | | |
| | | /** |
| | | * 根据角色获取菜单 |
| | | * |
| | | * @param roleIds |
| | | * @return |
| | | * @date 2017年2月19日 下午10:35:40 |
| | | */ |
| | | List<MenuNode> getMenusByRoleIds(List<Integer> roleIds); |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.Notice; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 通知表 服务类 |
| | | * </p> |
| | | * |
| | | * @author stylefeng123 |
| | | * @since 2018-02-22 |
| | | */ |
| | | public interface INoticeService extends IService<Notice> { |
| | | |
| | | /** |
| | | * 获取通知列表 |
| | | */ |
| | | List<Map<String, Object>> list(String condition); |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.OperationLog; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 操作日志 服务类 |
| | | * </p> |
| | | * |
| | | * @author stylefeng123 |
| | | * @since 2018-02-22 |
| | | */ |
| | | public interface IOperationLogService extends IService<OperationLog> { |
| | | |
| | | /** |
| | | * 获取操作日志列表 |
| | | */ |
| | | List<Map<String, Object>> getOperationLogs(Page<OperationLog> page, String beginTime, String endTime, String logName, String s, String orderByField, boolean asc); |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.Order; |
| | | import com.agentdriving.user.modular.system.warpper.*; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.agentdriving.user.modular.system.util.ResultUtil; |
| | | import com.agentdriving.user.modular.system.warpper.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 订单 |
| | | * @author pzb |
| | | * @Date 2023/2/16 15:47 |
| | | */ |
| | | public interface IOrderService extends IService<Order> { |
| | | |
| | | |
| | | /** |
| | | * 获取预估费用 |
| | | * @param uid |
| | | * @param estimatedCosts |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil<EstimatedCostsWarpper> getEstimatedCosts(Integer uid, EstimatedCosts estimatedCosts) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 下单操作 |
| | | * @param uid |
| | | * @param travelOrder |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil travelOrder(Integer uid, TravelOrder travelOrder) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 取消订单 |
| | | * @param uid |
| | | * @param orderId |
| | | * @param cause |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil cancelOrder(Integer uid, Long orderId, String cause) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取订单详情 |
| | | * @param uid |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | OrderInfoWarpper queryOrderInfo(Integer uid, Long orderId) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 修改订单终点 |
| | | * @param uid |
| | | * @param editOrderEndAddress |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil editOrderEndAddress(Integer uid, EditOrderEndAddress editOrderEndAddress) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取订单费用明细 |
| | | * @param uid |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | OrderPriceWarpper queryOrderPrice(Integer uid, Long orderId) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 重新计算费用明细 |
| | | * @param orderId |
| | | * @param couponId |
| | | * @param payType |
| | | * @param balance |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | OrderPriceWarpper calculationOfExpenses(Integer uid, Long orderId, Integer couponId, Integer payType, Double balance) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取支付页面的可用优惠券列表 |
| | | * @param uid |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<CouponWarpper> queryPayCouponList(Integer uid, Long orderId) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 支付订单操作 |
| | | * @param uid |
| | | * @param orderPayment |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil orderPayment(Integer uid, OrderPayment orderPayment) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 订单微信支付回调 |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil orderPayCallback(String orderId, String transaction_id) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 订单评价 |
| | | * @param uid |
| | | * @param orderId |
| | | * @param score |
| | | * @param content |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil orderAppraise(Integer uid, Long orderId, Integer score, String content) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取用户行程记录 |
| | | * @param uid |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<OrderListWarpper> queryMyOrder(Integer uid, Integer pageNum, Integer pageSize) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取未开票订单 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<OrderListWarpper> queryNotInvoiceOrder(Integer uid, NotInvoiceOrder notInvoiceOrder) throws Exception; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.PlatformRechargeRecord; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/5/6 14:10 |
| | | */ |
| | | public interface IPlatformRechargeRecordService extends IService<PlatformRechargeRecord> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.RechargeRecord; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/23 14:56 |
| | | */ |
| | | public interface IRechargeRecordService extends IService<RechargeRecord> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.Relation; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 角色和菜单关联表 服务类 |
| | | * </p> |
| | | * |
| | | * @author stylefeng123 |
| | | * @since 2018-02-22 |
| | | */ |
| | | public interface IRelationService extends IService<Relation> { |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.Revenue; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/13 10:09 |
| | | */ |
| | | public interface IRevenueService extends IService<Revenue> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.core.node.ZTreeNode; |
| | | import com.agentdriving.user.modular.system.model.Role; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 角色相关业务 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年1月10日 下午9:11:57 |
| | | */ |
| | | public interface IRoleService extends IService<Role> { |
| | | |
| | | /** |
| | | * 设置某个角色的权限 |
| | | * |
| | | * @param roleId 角色id |
| | | * @param ids 权限的id |
| | | * @date 2017年2月13日 下午8:26:53 |
| | | */ |
| | | void setAuthority(Integer roleId, String ids); |
| | | |
| | | /** |
| | | * 删除角色 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/5 22:24 |
| | | */ |
| | | void delRoleById(Integer roleId); |
| | | |
| | | /** |
| | | * 根据条件查询角色列表 |
| | | * |
| | | * @return |
| | | * @date 2017年2月12日 下午9:14:34 |
| | | */ |
| | | List<Map<String, Object>> selectRoles(@Param("condition") String condition); |
| | | |
| | | /** |
| | | * 删除某个角色的所有权限 |
| | | * |
| | | * @param roleId 角色id |
| | | * @return |
| | | * @date 2017年2月13日 下午7:57:51 |
| | | */ |
| | | int deleteRolesById(@Param("roleId") Integer roleId); |
| | | |
| | | /** |
| | | * 获取角色列表树 |
| | | * |
| | | * @return |
| | | * @date 2017年2月18日 上午10:32:04 |
| | | */ |
| | | List<ZTreeNode> roleTreeList(); |
| | | |
| | | /** |
| | | * 获取角色列表树 |
| | | * |
| | | * @return |
| | | * @date 2017年2月18日 上午10:32:04 |
| | | */ |
| | | List<ZTreeNode> roleTreeListByRoleId(String[] roleId); |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.SystemConfig; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.agentdriving.user.modular.system.warpper.PriceRulesWarpper; |
| | | |
| | | /** |
| | | * 系统配置 |
| | | * @author pzb |
| | | * @Date 2023/2/15 16:26 |
| | | */ |
| | | public interface ISystemConfigService extends IService<SystemConfig> { |
| | | |
| | | |
| | | /** |
| | | * 获取价格表 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | PriceRulesWarpper queryPriceRules() throws Exception; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.core.datascope.DataScope; |
| | | import com.agentdriving.user.modular.system.model.User; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 管理员表 服务类 |
| | | * </p> |
| | | * |
| | | * @author stylefeng123 |
| | | * @since 2018-02-22 |
| | | */ |
| | | public interface IUserService extends IService<User> { |
| | | |
| | | /** |
| | | * 修改用户状态 |
| | | */ |
| | | int setStatus(@Param("userId") Integer userId, @Param("status") int status); |
| | | |
| | | /** |
| | | * 修改密码 |
| | | */ |
| | | int changePwd(@Param("userId") Integer userId, @Param("pwd") String pwd); |
| | | |
| | | /** |
| | | * 根据条件查询用户列表 |
| | | */ |
| | | List<Map<String, Object>> selectUsers(@Param("dataScope") DataScope dataScope, @Param("name") String name, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("deptid") Integer deptid); |
| | | |
| | | /** |
| | | * 设置用户的角色 |
| | | */ |
| | | int setRoles(@Param("userId") Integer userId, @Param("roleIds") String roleIds); |
| | | |
| | | /** |
| | | * 通过账号获取用户 |
| | | */ |
| | | User getByAccount(@Param("account") String account); |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.Coupon; |
| | | import com.agentdriving.user.modular.system.model.UserToCoupon; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.agentdriving.user.modular.system.warpper.CouponWarpper; |
| | | import com.agentdriving.user.modular.system.warpper.CouponsWarpper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/2 14:21 |
| | | */ |
| | | public interface IUserToCouponService extends IService<UserToCoupon> { |
| | | |
| | | |
| | | /** |
| | | * 获取可用优惠券 |
| | | * @param uid |
| | | * @param price |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Coupon queryCoupon(Integer uid, Double price) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取订单支付页面的可用优惠券列表 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<CouponWarpper> queryPayCouponList(Integer uid, Double price) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取用户优惠券列表 |
| | | * @param uid |
| | | * @param state |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<CouponsWarpper> queryMyCoupons(Integer uid, Integer state, Integer pageNum, Integer pageSize) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取已使用优惠券数量 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | Integer queryUsedCouponNum(Integer uid); |
| | | |
| | | |
| | | /** |
| | | * 删除优惠券数据 |
| | | */ |
| | | void delUserCoupon(); |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.WeatherCity; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | public interface IWeatherCityService extends IService<WeatherCity> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service; |
| | | |
| | | import com.agentdriving.user.modular.system.model.YouTuiDriver; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | public interface IYouTuiDriverService extends IService<YouTuiDriver> { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.AccountChangeDetailMapper; |
| | | import com.agentdriving.user.modular.system.model.AccountChangeDetail; |
| | | import com.agentdriving.user.modular.system.service.IAccountChangeDetailService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.agentdriving.user.modular.system.warpper.BalanceDetailsWarpper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 账户变动 |
| | | * @author zhibing.pu |
| | | * @date 2023/3/4 11:34 |
| | | */ |
| | | @Service |
| | | public class AccountChangeDetailServiceImpl extends ServiceImpl<AccountChangeDetailMapper, AccountChangeDetail> implements IAccountChangeDetailService { |
| | | |
| | | |
| | | /** |
| | | * 保存数据 |
| | | * @param accountChangeDetail |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void saveData(AccountChangeDetail accountChangeDetail) throws Exception { |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | this.baseMapper.insert(accountChangeDetail); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取余额明细 |
| | | * @param uid |
| | | * @param time |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<BalanceDetailsWarpper> queryBalanceDetails(Integer uid, String time, Integer pageNum, Integer pageSize) throws Exception { |
| | | pageNum = (pageNum - 1) * pageSize; |
| | | return this.baseMapper.queryBalanceDetails(uid, time, pageNum, pageSize); |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.AgentMapper; |
| | | import com.agentdriving.user.modular.system.model.Agent; |
| | | import com.agentdriving.user.modular.system.service.IAgentService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/5/6 11:53 |
| | | */ |
| | | @Service |
| | | public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements IAgentService { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.core.common.constant.JwtConstants; |
| | | import com.agentdriving.user.core.shiro.ShiroKit; |
| | | import com.agentdriving.user.core.shiro.ShiroUser; |
| | | import com.agentdriving.user.core.util.JwtTokenUtil; |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.agentdriving.user.modular.system.dao.AppUserMapper; |
| | | import com.agentdriving.user.modular.system.model.*; |
| | | import com.agentdriving.user.modular.system.service.*; |
| | | import com.agentdriving.user.modular.system.warpper.*; |
| | | 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.agentdriving.user.modular.system.model.*; |
| | | import com.agentdriving.user.modular.system.service.*; |
| | | import com.agentdriving.user.modular.system.util.MallBook.model.InterfaceResponse; |
| | | import com.agentdriving.user.modular.system.util.MallBook.model.PaymentOrder; |
| | | import com.agentdriving.user.modular.system.util.MallBook.model.PaymentOrderGood; |
| | | import com.agentdriving.user.modular.system.util.MallBook.util.TrhRequest; |
| | | import com.agentdriving.user.modular.system.util.PayMoneyUtil; |
| | | import com.agentdriving.user.modular.system.util.RedisUtil; |
| | | import com.agentdriving.user.modular.system.util.ResultUtil; |
| | | import com.agentdriving.user.modular.system.util.UUIDUtil; |
| | | import com.agentdriving.user.modular.system.util.weChat.WXCore; |
| | | import com.agentdriving.user.modular.system.util.weChat.WeChatUtil; |
| | | import com.agentdriving.user.modular.system.util.weChat.model.Code2Session; |
| | | import com.agentdriving.user.modular.system.warpper.*; |
| | | 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.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.net.InetAddress; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 用户 |
| | | */ |
| | | @Service |
| | | public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> implements IAppUserService { |
| | | |
| | | @Autowired |
| | | private WeChatUtil weChatUtil; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | private final String salt = "s5d1"; |
| | | |
| | | @Autowired |
| | | private ICouponService couponService; |
| | | |
| | | @Autowired |
| | | private IUserToCouponService userToCouponService; |
| | | |
| | | @Autowired |
| | | private IRechargeRecordService rechargeRecordService; |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Autowired |
| | | private IAccountChangeDetailService accountChangeDetailService; |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath;//支付回调网关地址 |
| | | |
| | | @Value("${wx.appletsAppid}") |
| | | private String appletsAppid; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public ResultUtil<String> appUserLogin(String jscode) throws Exception { |
| | | Code2Session code2Session = weChatUtil.code2Session(jscode); |
| | | if(null != code2Session.getErrcode() && code2Session.getErrcode() != 0){ |
| | | return ResultUtil.error(code2Session.getErrmsg()); |
| | | } |
| | | String openid = code2Session.getOpenid(); |
| | | AppUser appUser = this.selectOne(new EntityWrapper<AppUser>().eq("openid", openid).eq("status", 1)); |
| | | if(null == appUser){ |
| | | return ResultUtil.error("无效的账号"); |
| | | } |
| | | String token = getToken(appUser); |
| | | if(ToolUtil.isEmpty(token)){ |
| | | return ResultUtil.error("获取身份凭证失败"); |
| | | } |
| | | return ResultUtil.success(token); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取身份凭证 |
| | | * @return |
| | | */ |
| | | public String getToken(AppUser appUser){ |
| | | //封装请求账号密码为shiro可验证的token |
| | | String phone = appUser.getPhone(); |
| | | UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(phone, phone.toCharArray()); |
| | | |
| | | String credentials = ShiroKit.md5(phone, salt); |
| | | 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) { |
| | | String token = JwtTokenUtil.generateToken(phone); |
| | | String key = token; |
| | | if(token.length() > 16){ |
| | | key = token.substring(token.length() - 16); |
| | | } |
| | | redisUtil.setStrValue(key, appUser.getId().toString(), 7 * 24 * 60 * 60); |
| | | redisUtil.setStrValue("USER_" + appUser.getPhone(), key, 7 * 24 * 60 * 60); |
| | | return token; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信授权注册登录 |
| | | * @param signInToRegister |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil<SignInToRegisterWarpper> signInToRegister(SignInToRegister signInToRegister) throws Exception { |
| | | SignInToRegisterWarpper warpper = new SignInToRegisterWarpper(); |
| | | if(ToolUtil.isEmpty(signInToRegister.getJscode())){ |
| | | return ResultUtil.paranErr("jscode"); |
| | | } |
| | | if(ToolUtil.isEmpty(signInToRegister.getEncryptedDataPhone())){ |
| | | return ResultUtil.paranErr("encryptedDataPhone"); |
| | | } |
| | | if(ToolUtil.isEmpty(signInToRegister.getIvPhone())){ |
| | | return ResultUtil.paranErr("ivPhone"); |
| | | } |
| | | Code2Session code2Session = weChatUtil.code2Session(signInToRegister.getJscode()); |
| | | if(null != code2Session.getErrcode() && code2Session.getErrcode() != 0){ |
| | | return ResultUtil.error(code2Session.getErrmsg()); |
| | | } |
| | | String openid = code2Session.getOpenid(); |
| | | String session_key = code2Session.getSession_key(); |
| | | String decrypt = WXCore.decrypt(signInToRegister.getEncryptedDataPhone(), session_key, signInToRegister.getIvPhone()); |
| | | if(ToolUtil.isEmpty(decrypt)){ |
| | | return ResultUtil.error("获取手机号失败"); |
| | | } |
| | | JSONObject phone = JSON.parseObject(decrypt); |
| | | String purePhoneNumber = phone.getString("purePhoneNumber"); |
| | | AppUser appUser = this.selectOne(new EntityWrapper<AppUser>().eq("phone", purePhoneNumber).ne("status", 3)); |
| | | if(null == appUser){ |
| | | appUser = new AppUser(); |
| | | appUser.setNickname("亲爱的用户"); |
| | | appUser.setAvatar("https://csxdj.obs.cn-south-1.myhuaweicloud.com:443/66cc269703a84e4da87fb21e2c21ab1f.png"); |
| | | appUser.setPhone(purePhoneNumber); |
| | | appUser.setOpenid(openid); |
| | | appUser.setUnionid(code2Session.getUnionid()); |
| | | appUser.setAccountBalance(0D); |
| | | appUser.setStatus(1); |
| | | appUser.setCreateTime(new Date()); |
| | | appUser.setIsException(1); |
| | | appUser.setInviterId(signInToRegister.getInviterId()); |
| | | appUser.setInviterType(signInToRegister.getInviterType()); |
| | | this.insert(appUser); |
| | | //发送优惠券 |
| | | boolean lock = redisUtil.lock(); |
| | | if(lock){ |
| | | List<CouponWarpper> list = pushCoupon(appUser.getId()); |
| | | redisUtil.unlock(); |
| | | warpper.setCoupons(list); |
| | | } |
| | | } |
| | | if(appUser.getStatus() == 2){ |
| | | return ResultUtil.error("账号被冻结"); |
| | | } |
| | | String token = getToken(appUser); |
| | | if(ToolUtil.isEmpty(token)){ |
| | | return ResultUtil.error("获取身份凭证失败"); |
| | | } |
| | | warpper.setToken(token); |
| | | return ResultUtil.success(warpper); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送优惠券 |
| | | * @param userId |
| | | */ |
| | | public List<CouponWarpper> pushCoupon(Integer userId){ |
| | | List<Coupon> coupons = couponService.selectList(new EntityWrapper<Coupon>().eq("coupon_type", 2) |
| | | .eq("coupon_state", 1).eq("status", 1).gt("remaining_quantity", 0)); |
| | | List<CouponWarpper> list = new ArrayList<>(); |
| | | for (Coupon coupon : coupons) { |
| | | UserToCoupon userToCoupon = new UserToCoupon(); |
| | | userToCoupon.setCouponId(coupon.getId()); |
| | | userToCoupon.setCreateTime(new Date()); |
| | | userToCoupon.setUserId(userId); |
| | | userToCoupon.setStatus(1); |
| | | userToCoupon.setCouponTotal(coupon.getCouponSendQuantity() > coupon.getRemainingQuantity() ? |
| | | coupon.getRemainingQuantity() : coupon.getCouponSendQuantity()); |
| | | userToCoupon.setValidCount(userToCoupon.getCouponTotal()); |
| | | userToCoupon.setExpireTime(new Date(System.currentTimeMillis() + (coupon.getCouponValidity() * 24 * 60 * 60 * 1000))); |
| | | userToCouponService.insert(userToCoupon); |
| | | |
| | | coupon.setRemainingQuantity(coupon.getCouponSendQuantity() > coupon.getRemainingQuantity() ? 0 : |
| | | coupon.getRemainingQuantity() - coupon.getCouponSendQuantity()); |
| | | couponService.updateById(coupon); |
| | | |
| | | CouponWarpper couponWarpper = new CouponWarpper(); |
| | | couponWarpper.setCouponConditionalAmount(coupon.getCouponConditionalAmount()); |
| | | couponWarpper.setCouponPreferentialAmount(coupon.getCouponPreferentialAmount()); |
| | | couponWarpper.setCouponName(coupon.getCouponName()); |
| | | couponWarpper.setNumber(userToCoupon.getValidCount()); |
| | | couponWarpper.setExpirationDate(userToCoupon.getExpireTime().getTime()); |
| | | list.add(couponWarpper); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Integer getUserByRequest() throws Exception { |
| | | ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); |
| | | HttpServletRequest request = servletRequestAttributes.getRequest(); |
| | | String requestHeader = request.getHeader(JwtConstants.AUTH_HEADER); |
| | | if (ToolUtil.isNotEmpty(requestHeader) && requestHeader.startsWith("Bearer ")) { |
| | | requestHeader = requestHeader.substring(requestHeader.indexOf(" ") + 1); |
| | | String key = null; |
| | | int length = requestHeader.length(); |
| | | if(length > 16){ |
| | | key = requestHeader.substring(length - 16); |
| | | }else{ |
| | | key = requestHeader; |
| | | } |
| | | String value = redisUtil.getValue(key); |
| | | return null != value ? Integer.valueOf(value) : null; |
| | | }else{ |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 修改个人信息 |
| | | * @param userInfo |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil updateUserInfo(Integer uid, UserInfo userInfo) throws Exception { |
| | | AppUser appUser = this.selectById(uid); |
| | | if(ToolUtil.isNotEmpty(userInfo.getAvatar())){ |
| | | appUser.setAvatar(userInfo.getAvatar()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmergencyContact())){ |
| | | appUser.setEmergencyContact(userInfo.getEmergencyContact()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(userInfo.getEmergencyPhone())){ |
| | | appUser.setEmergencyPhone(userInfo.getEmergencyPhone()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(userInfo.getNickname())){ |
| | | appUser.setNickname(userInfo.getNickname()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(userInfo.getPhone())){ |
| | | if(userInfo.getPhone().equals(appUser.getPhone())){ |
| | | return ResultUtil.error("新手机不能和原手机号相同"); |
| | | } |
| | | String value = redisUtil.getValue("+86" + userInfo.getPhone()); |
| | | if(ToolUtil.isEmpty(value) || !value.equals(userInfo.getCode())){ |
| | | return ResultUtil.error("验证码无效"); |
| | | } |
| | | appUser.setPhone(userInfo.getPhone()); |
| | | } |
| | | this.updateById(appUser); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | /** |
| | | * 余额充值 |
| | | * @param uid |
| | | * @param amount |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil rechargeBalance(Integer uid, Double amount) throws Exception { |
| | | if(0 >= amount){ |
| | | return ResultUtil.error("充值金额必须大于0"); |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String out_trade_no = sdf.format(new Date()) + UUIDUtil.getNumberRandom(3); |
| | | AppUser appUser = this.selectById(uid); |
| | | RechargeRecord rechargeRecord = new RechargeRecord(); |
| | | rechargeRecord.setType(1); |
| | | rechargeRecord.setUserId(uid); |
| | | rechargeRecord.setCode(out_trade_no); |
| | | rechargeRecord.setAmount(amount); |
| | | rechargeRecord.setCreateTime(new Date()); |
| | | rechargeRecord.setPayStatus(1); |
| | | rechargeRecord.setPayType(1); |
| | | rechargeRecordService.insert(rechargeRecord); |
| | | // ResultUtil weixinpay = payMoneyUtil.weixinpay("余额充值", "", out_trade_no, amount.toString(), "/base/appUser/rechargeBalanceCallback", "JSAPI", appUser.getOpenid()); |
| | | // return weixinpay; |
| | | |
| | | PaymentOrder paymentOrder = new PaymentOrder(); |
| | | paymentOrder.setBizOrderId(out_trade_no); |
| | | paymentOrder.setAmount(String.valueOf(amount * 100)); |
| | | paymentOrder.setOrderName("余额充值"); |
| | | paymentOrder.setPayType("WX_MINI"); |
| | | paymentOrder.setTransferType("0"); |
| | | paymentOrder.setAsynSplitFlag("1"); |
| | | paymentOrder.setAppid(appletsAppid); |
| | | paymentOrder.setOpenid(appUser.getOpenid()); |
| | | paymentOrder.setTerminalIp(InetAddress.getLocalHost().getHostAddress()); |
| | | List<PaymentOrderGood> goodsDetail = new ArrayList<>(); |
| | | PaymentOrderGood paymentOrderGood = new PaymentOrderGood(); |
| | | paymentOrderGood.setGoodsName("余额充值"); |
| | | goodsDetail.add(paymentOrderGood); |
| | | paymentOrder.setGoodsDetail(goodsDetail); |
| | | paymentOrder.setFrontUrl(""); |
| | | paymentOrder.setNotifyUrl(callbackPath + "/base/appUser/rechargeBalanceCallback"); |
| | | paymentOrder.setParameter1(out_trade_no); |
| | | |
| | | TrhRequest<PaymentOrder> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(paymentOrder, PaymentOrder.SERVICE_CODE); |
| | | if(!"0000".equals(execute.getResult())){ |
| | | return ResultUtil.error(execute.getMsg()); |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | String status = jsonObject.getString("status"); |
| | | if("2".equals(status)){ |
| | | return ResultUtil.error("失败"); |
| | | } |
| | | if("0".equals(status)){ |
| | | return ResultUtil.error("处理中"); |
| | | } |
| | | String payCode = jsonObject.getString("payCode"); |
| | | return ResultUtil.success(payCode); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 余额充值回调 |
| | | * @param out_trade_no |
| | | * @param transaction_id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void rechargeBalanceCallback(String out_trade_no, String transaction_id) throws Exception { |
| | | RechargeRecord rechargeRecord1 = rechargeRecordService.selectOne(new EntityWrapper<RechargeRecord>().eq("code", out_trade_no)); |
| | | if(rechargeRecord1.getPayStatus() != 1){ |
| | | return; |
| | | } |
| | | AppUser appUser = this.selectById(rechargeRecord1.getUserId()); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setUserType(1); |
| | | accountChangeDetail.setUserId(rechargeRecord1.getUserId()); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setChangeType(3); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setExplain("余额充值"); |
| | | accountChangeDetail.setOldData(appUser.getAccountBalance()); |
| | | appUser.setAccountBalance(appUser.getAccountBalance() + rechargeRecord1.getAmount()); |
| | | accountChangeDetail.setNewData(appUser.getAccountBalance()); |
| | | this.updateById(appUser); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | |
| | | rechargeRecord1.setPayTime(new Date()); |
| | | rechargeRecord1.setPayStatus(2); |
| | | rechargeRecord1.setOrderNumber(transaction_id); |
| | | rechargeRecordService.updateById(rechargeRecord1); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户优惠券列表 |
| | | * @param uid |
| | | * @param state |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<CouponsWarpper> queryMyCoupons(Integer uid, Integer state, Integer pageNum, Integer pageSize) throws Exception { |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.agentdriving.user.modular.system.dao.BillMapper; |
| | | import com.agentdriving.user.modular.system.model.Bill; |
| | | import com.agentdriving.user.modular.system.model.Order; |
| | | import com.agentdriving.user.modular.system.service.IBillService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.agentdriving.user.modular.system.service.IOrderService; |
| | | import com.agentdriving.user.modular.system.util.ResultUtil; |
| | | import com.agentdriving.user.modular.system.warpper.BillWarpper; |
| | | import com.agentdriving.user.modular.system.warpper.Invoicing; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/24 10:07 |
| | | */ |
| | | @Service |
| | | public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements IBillService { |
| | | |
| | | @Autowired |
| | | private IOrderService orderService; |
| | | |
| | | |
| | | /** |
| | | * 开票操作 |
| | | * @param uid |
| | | * @param invoicing |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil invoicing(Integer uid, Invoicing invoicing) throws Exception { |
| | | if(ToolUtil.isEmpty(invoicing.getOrderIds())){ |
| | | return ResultUtil.error("请选择有效的开票订单"); |
| | | } |
| | | String[] split = invoicing.getOrderIds().split(","); |
| | | List<Order> orders = orderService.selectBatchIds(Arrays.asList(split)); |
| | | for (Order order : orders) { |
| | | if(null != order.getIsInvoice() && order.getIsInvoice() == 1){ |
| | | continue; |
| | | } |
| | | Bill bill = new Bill(); |
| | | BeanUtils.copyProperties(invoicing, bill); |
| | | bill.setUserId(order.getUserId()); |
| | | bill.setOrderId(order.getId().intValue()); |
| | | bill.setBillType(1); |
| | | bill.setBillContent("代驾服务费"); |
| | | bill.setBillAmount(order.getPayMoney()); |
| | | bill.setState(1); |
| | | bill.setCreateTime(new Date()); |
| | | this.insert(bill); |
| | | |
| | | order.setIsInvoice(1); |
| | | orderService.updateById(order); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取开票记录 |
| | | * @param uid |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<BillWarpper> queryBillList(Integer uid, Integer pageNum, Integer pageSize) throws Exception { |
| | | pageNum = (pageNum - 1) * pageSize; |
| | | return this.baseMapper.queryBillList(uid, pageNum, pageSize); |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.BroadcastMapper; |
| | | import com.agentdriving.user.modular.system.model.Broadcast; |
| | | import com.agentdriving.user.modular.system.service.IBroadcastService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 广播 |
| | | * @author pzb |
| | | * @Date 2023/2/27 17:10 |
| | | */ |
| | | @Service |
| | | public class BroadcastServiceImpl extends ServiceImpl<BroadcastMapper, Broadcast> implements IBroadcastService { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.CancelOrderMapper; |
| | | import com.agentdriving.user.modular.system.model.CancelOrder; |
| | | import com.agentdriving.user.modular.system.service.ICancelOrderService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 取消订单记录 |
| | | * @author pzb |
| | | * @Date 2023/2/25 14:45 |
| | | */ |
| | | @Service |
| | | public class CancelOrderServiceImpl extends ServiceImpl<CancelOrderMapper, CancelOrder> implements ICancelOrderService { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.CommercialMapper; |
| | | import com.agentdriving.user.modular.system.model.Commercial; |
| | | import com.agentdriving.user.modular.system.model.CommercialUserEject; |
| | | import com.agentdriving.user.modular.system.service.ICommercialService; |
| | | import com.agentdriving.user.modular.system.service.ICommercialUserEjectService; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.agentdriving.user.modular.system.util.UUIDUtil; |
| | | import com.agentdriving.user.modular.system.warpper.CommercialWarpper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 广告逻辑类 |
| | | */ |
| | | @Service |
| | | public class CommercialServiceImpl extends ServiceImpl<CommercialMapper, Commercial> implements ICommercialService { |
| | | |
| | | @Autowired |
| | | private ICommercialUserEjectService commercialUserEjectService; |
| | | |
| | | |
| | | /** |
| | | * 获取广告列表 |
| | | * @param type 广告类型(1=弹窗广告) |
| | | * @param device 设备(1=小程序,2=司机端) |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<CommercialWarpper> queryCommercialList(Integer uid, Integer type, Integer device) throws Exception { |
| | | if(type == 1){//弹框广告 |
| | | CommercialUserEject commercialUserEject = commercialUserEjectService.selectOne(new EntityWrapper<CommercialUserEject>().eq("userType", 2) |
| | | .eq("userId", uid).last(" and DATE_FORMAT(now(), '%Y%m%d') = DATE_FORMAT(lastDate, '%Y%m%d')")); |
| | | if(null != commercialUserEject){ |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | | List<CommercialWarpper> commercialWarppers = this.baseMapper.queryCommercialList(type, device); |
| | | if(type == 1 && commercialWarppers.size() > 0){//记录弹窗 |
| | | CommercialUserEject commercialUserEject = new CommercialUserEject(); |
| | | commercialUserEject.setId(Long.valueOf(UUIDUtil.getNumberRandom(16))); |
| | | commercialUserEject.setLastDate(new Date()); |
| | | commercialUserEject.setUserId(uid); |
| | | commercialUserEject.setUserType(2); |
| | | commercialUserEjectService.insert(commercialUserEject); |
| | | } |
| | | return commercialWarppers; |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.CommercialUserEjectMapper; |
| | | import com.agentdriving.user.modular.system.model.CommercialUserEject; |
| | | import com.agentdriving.user.modular.system.service.ICommercialUserEjectService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class CommercialUserEjectServiceImpl extends ServiceImpl<CommercialUserEjectMapper, CommercialUserEject> implements ICommercialUserEjectService { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.ComplaintMapper; |
| | | import com.agentdriving.user.modular.system.model.Complaint; |
| | | import com.agentdriving.user.modular.system.model.Order; |
| | | import com.agentdriving.user.modular.system.service.IComplaintService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.agentdriving.user.modular.system.service.IOrderService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/24 16:07 |
| | | */ |
| | | @Service |
| | | public class ComplaintServiceImpl extends ServiceImpl<ComplaintMapper, Complaint> implements IComplaintService { |
| | | |
| | | @Autowired |
| | | private IOrderService orderService; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 投诉反馈 |
| | | * @param orderId |
| | | * @param content |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void feedback(Integer uid, Integer orderId, String content) throws Exception { |
| | | Complaint complaint = new Complaint(); |
| | | complaint.setUserId(uid); |
| | | if(null != orderId){ |
| | | Order order = orderService.selectById(orderId); |
| | | complaint.setOrderId(orderId); |
| | | complaint.setDriverId(order.getDriverId()); |
| | | } |
| | | complaint.setReason(content); |
| | | complaint.setState(1); |
| | | complaint.setStatus(1); |
| | | complaint.setCreateTime(new Date()); |
| | | this.insert(complaint); |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.CouponMapper; |
| | | import com.agentdriving.user.modular.system.model.Coupon; |
| | | import com.agentdriving.user.modular.system.service.ICouponService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> implements ICouponService { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.core.node.ZTreeNode; |
| | | import com.agentdriving.user.modular.system.dao.DeptMapper; |
| | | import com.agentdriving.user.modular.system.model.Dept; |
| | | import com.agentdriving.user.modular.system.service.IDeptService; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | @Transactional |
| | | public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements IDeptService { |
| | | |
| | | @Resource |
| | | private DeptMapper deptMapper; |
| | | |
| | | @Override |
| | | public void deleteDept(Integer deptId) { |
| | | Dept dept = deptMapper.selectById(deptId); |
| | | |
| | | Wrapper<Dept> wrapper = new EntityWrapper<>(); |
| | | wrapper = wrapper.like("pids", "%[" + dept.getId() + "]%"); |
| | | List<Dept> subDepts = deptMapper.selectList(wrapper); |
| | | for (Dept temp : subDepts) { |
| | | temp.deleteById(); |
| | | } |
| | | |
| | | dept.deleteById(); |
| | | } |
| | | |
| | | @Override |
| | | public List<ZTreeNode> tree() { |
| | | return this.baseMapper.tree(); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> list(String condition) { |
| | | return this.baseMapper.list(condition); |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.core.common.constant.factory.MutiStrFactory; |
| | | import com.agentdriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.agentdriving.user.core.exception.GunsException; |
| | | import com.agentdriving.user.modular.system.dao.DictMapper; |
| | | import com.agentdriving.user.modular.system.model.Dict; |
| | | import com.agentdriving.user.modular.system.service.IDictService; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | @Transactional |
| | | public class DictServiceImpl extends ServiceImpl<DictMapper, Dict> implements IDictService { |
| | | |
| | | @Resource |
| | | private DictMapper dictMapper; |
| | | |
| | | @Override |
| | | public void addDict(String dictCode,String dictName,String dictTips, String dictValues) { |
| | | //判断有没有该字典 |
| | | List<Dict> dicts = dictMapper.selectList(new EntityWrapper<Dict>().eq("code", dictCode).and().eq("pid", 0)); |
| | | if (dicts != null && dicts.size() > 0) { |
| | | throw new GunsException(BizExceptionEnum.DICT_EXISTED); |
| | | } |
| | | |
| | | //解析dictValues |
| | | List<Map<String, String>> items = MutiStrFactory.parseKeyValue(dictValues); |
| | | |
| | | //添加字典 |
| | | Dict dict = new Dict(); |
| | | dict.setName(dictName); |
| | | dict.setCode(dictCode); |
| | | dict.setTips(dictTips); |
| | | dict.setNum(0); |
| | | dict.setPid(0); |
| | | this.dictMapper.insert(dict); |
| | | |
| | | //添加字典条目 |
| | | for (Map<String, String> item : items) { |
| | | String code = item.get(MutiStrFactory.MUTI_STR_CODE); |
| | | String name = item.get(MutiStrFactory.MUTI_STR_NAME); |
| | | String num = item.get(MutiStrFactory.MUTI_STR_NUM); |
| | | Dict itemDict = new Dict(); |
| | | itemDict.setPid(dict.getId()); |
| | | itemDict.setCode(code); |
| | | itemDict.setName(name); |
| | | |
| | | try { |
| | | itemDict.setNum(Integer.valueOf(num)); |
| | | } catch (NumberFormatException e) { |
| | | throw new GunsException(BizExceptionEnum.DICT_MUST_BE_NUMBER); |
| | | } |
| | | this.dictMapper.insert(itemDict); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void editDict(Integer dictId,String dictCode, String dictName,String dictTips, String dicts) { |
| | | //删除之前的字典 |
| | | this.delteDict(dictId); |
| | | |
| | | //重新添加新的字典 |
| | | this.addDict(dictCode,dictName,dictTips, dicts); |
| | | } |
| | | |
| | | @Override |
| | | public void delteDict(Integer dictId) { |
| | | //删除这个字典的子词典 |
| | | Wrapper<Dict> dictEntityWrapper = new EntityWrapper<>(); |
| | | dictEntityWrapper = dictEntityWrapper.eq("pid", dictId); |
| | | dictMapper.delete(dictEntityWrapper); |
| | | |
| | | //删除这个词典 |
| | | dictMapper.deleteById(dictId); |
| | | } |
| | | |
| | | @Override |
| | | public List<Dict> selectByCode(String code) { |
| | | return this.baseMapper.selectByCode(code); |
| | | } |
| | | |
| | | @Override |
| | | public List<Dict> selectByParentCode(String code) { |
| | | return this.baseMapper.selectByParentCode(code); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> list(String conditiion) { |
| | | return this.baseMapper.list(conditiion); |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.DivisionRecordMapper; |
| | | import com.agentdriving.user.modular.system.model.DivisionRecord; |
| | | import com.agentdriving.user.modular.system.service.IDivisionRecordService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/5/6 16:42 |
| | | */ |
| | | @Service |
| | | public class DivisionRecordServiceImpl extends ServiceImpl<DivisionRecordMapper, DivisionRecord> implements IDivisionRecordService { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.agentdriving.user.modular.system.dao.DriverMapper; |
| | | import com.agentdriving.user.modular.system.model.Driver; |
| | | import com.agentdriving.user.modular.system.model.DriverWork; |
| | | import com.agentdriving.user.modular.system.service.IDriverService; |
| | | import com.agentdriving.user.modular.system.service.IDriverWorkService; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.agentdriving.user.modular.system.util.GeodesyUtil; |
| | | import com.agentdriving.user.modular.system.util.RedisUtil; |
| | | import com.agentdriving.user.modular.system.util.mongodb.model.Location; |
| | | import com.agentdriving.user.modular.system.warpper.NearbyDriverWarpper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.geo.Circle; |
| | | import org.springframework.data.geo.Distance; |
| | | import org.springframework.data.geo.Metrics; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.geo.GeoJsonPoint; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 司机 |
| | | * @author pzb |
| | | * @Date 2023/2/8 18:52 |
| | | */ |
| | | @Service |
| | | public class DriverServiceImpl extends ServiceImpl<DriverMapper, Driver> implements IDriverService { |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Autowired |
| | | private IDriverWorkService driverWorkService; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | /** |
| | | * 获取5公里范围内的司机 |
| | | * @param lon |
| | | * @param lat |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<NearbyDriverWarpper> queryDriverPosition(String lon, String lat, Double scope) throws Exception { |
| | | List<NearbyDriverWarpper> list = new ArrayList<>(); |
| | | //找到中心点 |
| | | GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(lon), Double.valueOf(lat)); |
| | | //构造半径 |
| | | Distance distanceR = new Distance(scope, Metrics.KILOMETERS); |
| | | //画圆 |
| | | Circle circle = new Circle(geoJsonPoint, distanceR); |
| | | // 构造query对象 |
| | | Query query = Query.query(Criteria.where("location").withinSphere(circle)); |
| | | List<Location> locations = mongoTemplate.find(query, Location.class); |
| | | // System.err.println("附近空闲司机" + JSON.toJSONString(locations)); |
| | | List<Integer> collect = locations.stream().map(Location::getDriverId).collect(Collectors.toList()); |
| | | List<DriverWork> driverWorks = driverWorkService.selectList(new EntityWrapper<DriverWork>().in("driverId", collect).eq("status", 1)); |
| | | for (DriverWork driverWork : driverWorks) { |
| | | String value = redisUtil.getValue("DRIVER" + driverWork.getDriverId()); |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | NearbyDriverWarpper nearbyDriverWarpper = new NearbyDriverWarpper(); |
| | | nearbyDriverWarpper.setLonLat(value); |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(value, lon + "," + lat); |
| | | nearbyDriverWarpper.setDistance(distance.get("WGS84") / 1000); |
| | | nearbyDriverWarpper.setDriverId(driverWork.getDriverId()); |
| | | list.add(nearbyDriverWarpper); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.DriverWorkMapper; |
| | | import com.agentdriving.user.modular.system.model.DriverWork; |
| | | import com.agentdriving.user.modular.system.service.IDriverWorkService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | |
| | | /** |
| | | * 司机上下班操作记录 |
| | | * @author pzb |
| | | * @Date 2023/2/15 15:48 |
| | | */ |
| | | @Service |
| | | public class DriverWorkServiceImpl extends ServiceImpl<DriverWorkMapper, DriverWork> implements IDriverWorkService { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.EvaluateMapper; |
| | | import com.agentdriving.user.modular.system.model.Evaluate; |
| | | import com.agentdriving.user.modular.system.service.IEvaluateService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/11 17:00 |
| | | */ |
| | | @Service |
| | | public class EvaluateServiceImpl extends ServiceImpl<EvaluateMapper, Evaluate> implements IEvaluateService { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.HtmlMapper; |
| | | import com.agentdriving.user.modular.system.model.Html; |
| | | import com.agentdriving.user.modular.system.service.IHtmlService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * TODO 协议 |
| | | * @author 39373 |
| | | * @date 2023/2/26 17:31 |
| | | */ |
| | | @Service |
| | | public class HtmlServiceImpl extends ServiceImpl<HtmlMapper, Html> implements IHtmlService { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.LoginLogMapper; |
| | | import com.agentdriving.user.modular.system.model.LoginLog; |
| | | import com.agentdriving.user.modular.system.service.ILoginLogService; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 登录记录 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author stylefeng123 |
| | | * @since 2018-02-22 |
| | | */ |
| | | @Service |
| | | public class LoginLogServiceImpl extends ServiceImpl<LoginLogMapper, LoginLog> implements ILoginLogService { |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getLoginLogs(Page<LoginLog> page, String beginTime, String endTime, String logName, String orderByField, boolean asc) { |
| | | return this.baseMapper.getLoginLogs(page, beginTime, endTime, logName, orderByField, asc); |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.MainContentMapper; |
| | | import com.agentdriving.user.modular.system.model.MainContent; |
| | | import com.agentdriving.user.modular.system.service.IMainContentService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class MainContentServiceImpl extends ServiceImpl<MainContentMapper, MainContent> implements IMainContentService { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.core.node.MenuNode; |
| | | import com.agentdriving.user.core.node.ZTreeNode; |
| | | import com.agentdriving.user.modular.system.dao.MenuMapper; |
| | | import com.agentdriving.user.modular.system.model.Menu; |
| | | import com.agentdriving.user.modular.system.service.IMenuService; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 菜单服务 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-05 22:20 |
| | | */ |
| | | @Service |
| | | public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IMenuService { |
| | | |
| | | @Resource |
| | | private MenuMapper menuMapper; |
| | | |
| | | @Override |
| | | public void delMenu(Long menuId) { |
| | | |
| | | //删除菜单 |
| | | this.menuMapper.deleteById(menuId); |
| | | |
| | | //删除关联的relation |
| | | this.menuMapper.deleteRelationByMenu(menuId); |
| | | } |
| | | |
| | | @Override |
| | | public void delMenuContainSubMenus(Long menuId) { |
| | | |
| | | Menu menu = menuMapper.selectById(menuId); |
| | | |
| | | //删除当前菜单 |
| | | delMenu(menuId); |
| | | |
| | | //删除所有子菜单 |
| | | Wrapper<Menu> wrapper = new EntityWrapper<>(); |
| | | wrapper = wrapper.like("pcodes", "%[" + menu.getCode() + "]%"); |
| | | List<Menu> menus = menuMapper.selectList(wrapper); |
| | | for (Menu temp : menus) { |
| | | delMenu(temp.getId()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selectMenus(String condition, String level) { |
| | | return this.baseMapper.selectMenus(condition, level); |
| | | } |
| | | |
| | | @Override |
| | | public List<Long> getMenuIdsByRoleId(Integer roleId) { |
| | | return this.baseMapper.getMenuIdsByRoleId(roleId); |
| | | } |
| | | |
| | | @Override |
| | | public List<ZTreeNode> menuTreeList() { |
| | | return this.baseMapper.menuTreeList(); |
| | | } |
| | | |
| | | @Override |
| | | public List<ZTreeNode> menuTreeListByMenuIds(List<Long> menuIds) { |
| | | return this.baseMapper.menuTreeListByMenuIds(menuIds); |
| | | } |
| | | |
| | | @Override |
| | | public int deleteRelationByMenu(Long menuId) { |
| | | return this.baseMapper.deleteRelationByMenu(menuId); |
| | | } |
| | | |
| | | @Override |
| | | public List<String> getResUrlsByRoleId(Integer roleId) { |
| | | return this.baseMapper.getResUrlsByRoleId(roleId); |
| | | } |
| | | |
| | | @Override |
| | | public List<MenuNode> getMenusByRoleIds(List<Integer> roleIds) { |
| | | return this.baseMapper.getMenusByRoleIds(roleIds); |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.NoticeMapper; |
| | | import com.agentdriving.user.modular.system.model.Notice; |
| | | import com.agentdriving.user.modular.system.service.INoticeService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 通知表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author stylefeng123 |
| | | * @since 2018-02-22 |
| | | */ |
| | | @Service |
| | | public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> implements INoticeService { |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> list(String condition) { |
| | | return this.baseMapper.list(condition); |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.OperationLogMapper; |
| | | import com.agentdriving.user.modular.system.model.OperationLog; |
| | | import com.agentdriving.user.modular.system.service.IOperationLogService; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 操作日志 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author stylefeng123 |
| | | * @since 2018-02-22 |
| | | */ |
| | | @Service |
| | | public class OperationLogServiceImpl extends ServiceImpl<OperationLogMapper, OperationLog> implements IOperationLogService { |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getOperationLogs(Page<OperationLog> page, String beginTime, String endTime, String logName, String s, String orderByField, boolean asc) { |
| | | return this.baseMapper.getOperationLogs(page, beginTime, endTime, logName, s, orderByField, asc); |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.model.*; |
| | | import com.agentdriving.user.modular.system.service.*; |
| | | import com.agentdriving.user.modular.system.util.*; |
| | | import com.agentdriving.user.modular.system.util.MallBook.model.*; |
| | | import com.agentdriving.user.modular.system.warpper.*; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.agentdriving.user.modular.system.dao.OrderMapper; |
| | | import com.agentdriving.user.modular.system.model.*; |
| | | import com.agentdriving.user.modular.system.service.*; |
| | | import com.agentdriving.user.modular.system.util.*; |
| | | import com.agentdriving.user.modular.system.util.GaoDe.MapUtil; |
| | | import com.agentdriving.user.modular.system.util.GaoDe.model.District; |
| | | import com.agentdriving.user.modular.system.util.MallBook.model.*; |
| | | import com.agentdriving.user.modular.system.util.MallBook.util.Transfer; |
| | | import com.agentdriving.user.modular.system.util.MallBook.util.TrhRequest; |
| | | import com.agentdriving.user.modular.system.util.juhe.WeatherUtil; |
| | | import com.agentdriving.user.modular.system.util.mongodb.model.Location; |
| | | import com.agentdriving.user.modular.system.warpper.*; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.geo.Circle; |
| | | import org.springframework.data.geo.Distance; |
| | | import org.springframework.data.geo.Metrics; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.geo.GeoJsonPoint; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.net.InetAddress; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | | * 订单 |
| | | * @author pzb |
| | | * @Date 2023/2/16 15:57 |
| | | */ |
| | | @Service |
| | | public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements IOrderService { |
| | | |
| | | @Autowired |
| | | private ISystemConfigService systemConfigService; |
| | | |
| | | @Autowired |
| | | private IWeatherCityService weatherCityService; |
| | | |
| | | @Autowired |
| | | private IUserToCouponService userToCouponService; |
| | | |
| | | @Autowired |
| | | private IAppUserService appUserService; |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | | |
| | | @Autowired |
| | | private IYouTuiDriverService youTuiDriverService; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Autowired |
| | | private IDriverWorkService driverWorkService; |
| | | |
| | | @Autowired |
| | | private ICancelOrderService cancelOrderService; |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Autowired |
| | | private ICouponService couponService; |
| | | |
| | | @Autowired |
| | | private IAccountChangeDetailService accountChangeDetailService; |
| | | |
| | | @Autowired |
| | | private IEvaluateService evaluateService; |
| | | |
| | | @Autowired |
| | | private IRevenueService revenueService; |
| | | |
| | | @Autowired |
| | | private IAgentService agentService; |
| | | |
| | | @Autowired |
| | | private IPlatformRechargeRecordService platformRechargeRecordService; |
| | | |
| | | @Autowired |
| | | private IDivisionRecordService divisionRecordService; |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath;//支付回调网关地址 |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取预估费用 |
| | | * @param uid |
| | | * @param estimatedCosts |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil<EstimatedCostsWarpper> getEstimatedCosts(Integer uid, EstimatedCosts estimatedCosts) throws Exception { |
| | | EstimatedCostsWarpper estimatedCostsWarpper = new EstimatedCostsWarpper(); |
| | | Double d = 0D; |
| | | if(ToolUtil.isNotEmpty(estimatedCosts.getEndAddress())){ |
| | | Map<String, String> distance = MapUtil.getDistance(estimatedCosts.getStartLng() + "," + estimatedCosts.getStartLat(), |
| | | estimatedCosts.getEndLng() + "," + estimatedCosts.getEndLat(), 1); |
| | | if(null == distance){ |
| | | return ResultUtil.error("获取预估距离出错"); |
| | | } |
| | | d = Double.valueOf(distance.get("distance")) / 1000; |
| | | estimatedCostsWarpper.setEstimatedMileage(d); |
| | | estimatedCostsWarpper.setTravelTime(Integer.valueOf(distance.get("duration")) / 60); |
| | | } |
| | | String city = ""; |
| | | District geocode = MapUtil.geocode(estimatedCosts.getStartLng().toString(), estimatedCosts.getStartLat().toString()); |
| | | if(null != geocode){ |
| | | WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>() |
| | | .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); |
| | | city = null != weatherCity ? weatherCity.getId().toString() : ""; |
| | | } |
| | | Order order = getOrderPrice(1, d, 0, new Order(), city); |
| | | Double estimatedPrice = order.getEstimatedPrice(); |
| | | Coupon coupon = userToCouponService.queryCoupon(uid, estimatedPrice); |
| | | if(null != coupon){ |
| | | Double couponPreferentialAmount = coupon.getCouponPreferentialAmount(); |
| | | estimatedCostsWarpper.setPrice(estimatedPrice - couponPreferentialAmount); |
| | | estimatedCostsWarpper.setDiscountAmount(couponPreferentialAmount); |
| | | }else{ |
| | | estimatedCostsWarpper.setPrice(estimatedPrice); |
| | | estimatedCostsWarpper.setDiscountAmount(0D); |
| | | } |
| | | //预估接驾时间 |
| | | int i = 0; |
| | | Double scope = 5D; |
| | | while (true){ |
| | | List<NearbyDriverWarpper> nearbyDriverWarppers = driverService.queryDriverPosition(estimatedCosts.getLng().toString(), estimatedCosts.getLat().toString(), scope); |
| | | if(nearbyDriverWarppers.size() == 0){ |
| | | scope += 5; |
| | | i++; |
| | | if(i >= 10){ |
| | | estimatedCostsWarpper.setPickUpTime(60); |
| | | break; |
| | | } |
| | | continue; |
| | | } |
| | | if(nearbyDriverWarppers.size() > 0){ |
| | | NearbyDriverWarpper nearbyDriverWarpper = nearbyDriverWarppers.get(0); |
| | | Map<String, String> distance = MapUtil.getDistance(nearbyDriverWarpper.getLonLat(), estimatedCosts.getStartLng() + "," + estimatedCosts.getStartLat(), 1); |
| | | if(null != distance){ |
| | | distance.get("distance");//距离(M) |
| | | String duration = distance.get("duration");//时间(S) |
| | | estimatedCostsWarpper.setPickUpTime(Integer.valueOf(duration) / 60); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | return ResultUtil.success(estimatedCostsWarpper); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取订单价格 |
| | | * @param type 计算类型(1=预估价,2=订单费) |
| | | * @param distance 行驶公里 |
| | | * @param waitTime 等待时长 |
| | | * @param order 订单数据 |
| | | * @param city 查询天气的城市 |
| | | * @return |
| | | */ |
| | | public Order getOrderPrice(Integer type, Double distance, Integer waitTime, Order order, String city){ |
| | | order = getOrderInitialPrice(order); |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 5)); |
| | | if(null == systemConfig){ |
| | | if(type == 1){//预估金额 |
| | | order.setEstimatedPrice(0D); |
| | | } |
| | | if(type == 2){//订单金额 |
| | | order.setOrderMoney(0D); |
| | | } |
| | | return order; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | JSONArray chargeStandard = jsonObject.getJSONArray("ChargeStandard"); |
| | | JSONObject extraCost = jsonObject.getJSONObject("ExtraCost"); |
| | | Date date = new Date(); |
| | | for (int i = 0; i < chargeStandard.size(); i++) { |
| | | JSONObject jsonObject1 = chargeStandard.getJSONObject(i); |
| | | String num1 = jsonObject1.getString("num1"); |
| | | String num2 = jsonObject1.getString("num2"); |
| | | Double num3 = jsonObject1.getDouble("num3");//起步里程 |
| | | Double num4 = jsonObject1.getDouble("num4");//起步价格 |
| | | Double num5 = jsonObject1.getDouble("num5");//超过公里 |
| | | Double num6 = jsonObject1.getDouble("num6");//超过num3每num5公里收取num6 |
| | | Double num7 = jsonObject1.getDouble("num7");//长途起始公里 |
| | | Double num8 = jsonObject1.getDouble("num8");//长途结束公里 |
| | | Double num9 = jsonObject1.getDouble("num9");//长途费 |
| | | Double num10 = jsonObject1.getDouble("num10");//超出长途里程每num10公里 |
| | | Double num11 = jsonObject1.getDouble("num11");//超过num8每num10公里收取num11 |
| | | |
| | | String[] split = num1.split(":"); |
| | | Calendar s = Calendar.getInstance(); |
| | | s.setTime(date); |
| | | s.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); |
| | | s.set(Calendar.MINUTE, Integer.valueOf(split[1])); |
| | | s.set(Calendar.SECOND, 0); |
| | | |
| | | split = num2.split(":"); |
| | | Calendar e = Calendar.getInstance(); |
| | | e.setTime(date); |
| | | e.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); |
| | | e.set(Calendar.MINUTE, Integer.valueOf(split[1])); |
| | | e.set(Calendar.SECOND, 0); |
| | | |
| | | if(date.getTime() >= s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){ |
| | | if(num3.compareTo(distance) >= 0){//起步里程内 |
| | | order.setStartDistance(distance);//起步里程 |
| | | order.setStartPrice(num4);//起步价 |
| | | }else{ |
| | | BigDecimal subtract = new BigDecimal(distance).subtract(new BigDecimal(num3));//超出起步里程 |
| | | BigDecimal divide = subtract.divide(new BigDecimal(num5), new MathContext(2, RoundingMode.HALF_EVEN)); |
| | | BigDecimal multiply = divide.multiply(new BigDecimal(num6)); |
| | | order.setStartDistance(num3);//起步里程 |
| | | order.setStartPrice(num4);//起步价 |
| | | order.setOverDriveDistance(subtract.doubleValue());//超出起步里程 |
| | | order.setOverDrivePrice(multiply.doubleValue());//超出起步里程费 |
| | | |
| | | //计算长途费 |
| | | if(distance.compareTo(num7) > 0){ |
| | | order.setLongDistance(num7 + "-" + num8);//长途里程 |
| | | order.setLongDistancePrice(num9);//长途费 |
| | | } |
| | | //计算长途里程超出的部分 |
| | | if(distance.compareTo(num8) > 0){ |
| | | BigDecimal subtract1 = new BigDecimal(distance).subtract(new BigDecimal(num8)); |
| | | BigDecimal divide1 = subtract1.divide(new BigDecimal(num10), new MathContext(2, RoundingMode.HALF_EVEN)); |
| | | BigDecimal multiply1 = divide1.multiply(new BigDecimal(num11)); |
| | | order.setOverLongDistance(subtract1.doubleValue());//超出长途里程 |
| | | order.setOverLongDistancePrice(multiply1.doubleValue());//超出长途里程费 |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | //计算额外费用 |
| | | Integer num1 = extraCost.getInteger("num1");//等待时长 |
| | | Double num2 = extraCost.getDouble("num2");//等待费 |
| | | Integer num3 = extraCost.getInteger("num3");//等待超出时长 |
| | | Double num4 = extraCost.getDouble("num4");//等到超出时长费用单价 X/分钟 |
| | | Double num5 = extraCost.getDouble("num5");//恶劣天气公里 |
| | | Double num6 = extraCost.getDouble("num6");//恶劣天气费 |
| | | Double num7 = extraCost.getDouble("num7");//恶劣天气超出公里 |
| | | Double num8 = extraCost.getDouble("num8");//恶劣天气超出公里单价 X/公里 |
| | | Double num9 = extraCost.getDouble("num9");//恶劣天气最高收取金额 |
| | | |
| | | //等待费用 |
| | | if(waitTime.compareTo(num1) >= 0){ |
| | | order.setWaitTime(num1);//等待时长 |
| | | order.setWaitTimePrice(num2);//等待费用 |
| | | |
| | | Integer w = waitTime - num3; |
| | | BigDecimal multiply = new BigDecimal(w).multiply(new BigDecimal(num4)); |
| | | order.setOutWaitTime(w);//等待时长超出分钟 |
| | | order.setOutWaitTimePrice(multiply.doubleValue());//等待时长超出费用 |
| | | } |
| | | |
| | | //恶劣天气 |
| | | systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 8)); |
| | | if(null != systemConfig){ |
| | | JSONObject jsonObject1 = JSON.parseObject(systemConfig.getContent()); |
| | | Integer num11 = jsonObject1.getInteger("num1");//开启恶劣天气计价 |
| | | if(1 == num11){ |
| | | boolean badWeather = WeatherUtil.isBadWeather(city); |
| | | if(badWeather){ |
| | | order.setBadWeatherDistance(num5);//恶劣天气公里 |
| | | order.setBadWeatherPrice(num6);//恶劣天气费 |
| | | if(distance.compareTo(num7) > 0){ |
| | | BigDecimal subtract = new BigDecimal(distance).subtract(new BigDecimal(num7)); |
| | | BigDecimal multiply = subtract.multiply(new BigDecimal(num8)); |
| | | order.setOverBadWeatherDistance(subtract.doubleValue());//恶劣天气超出公里 |
| | | order.setOverBadWeatherPrice(multiply.doubleValue());//恶劣天气超出公里费 |
| | | } |
| | | |
| | | double add = new BigDecimal(order.getOverBadWeatherPrice()).add(new BigDecimal(order.getBadWeatherPrice())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | if(num9.compareTo(add) < 0){//超出最高金额(重新调整金额) |
| | | if(num9.compareTo(num6) < 0){//如果恶劣天气费大于最高金额 |
| | | order.setBadWeatherPrice(num9);//恶劣天气费 |
| | | order.setOverBadWeatherPrice(0D);//恶劣天气超出公里费 |
| | | }else{ |
| | | BigDecimal subtract = new BigDecimal(num9).subtract(new BigDecimal(add)); |
| | | order.setOverBadWeatherPrice(subtract.doubleValue());//恶劣天气超出公里费 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //计算总金额 |
| | | BigDecimal bigDecimal = new BigDecimal(order.getStartPrice() + order.getOverDrivePrice() + order.getLongDistancePrice() + order.getOverLongDistancePrice() + |
| | | order.getWaitTimePrice() + order.getOutWaitTimePrice() + order.getBadWeatherPrice() + order.getOverBadWeatherPrice() - order.getDiscountAmount()).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | |
| | | if(type == 1){//预估价 |
| | | order.setEstimatedPrice(bigDecimal.doubleValue()); |
| | | } |
| | | if(type == 2){//订单金额 |
| | | order.setOrderMoney(bigDecimal.doubleValue()); |
| | | } |
| | | return order; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 初始订单费用 |
| | | * @param order |
| | | * @return |
| | | */ |
| | | public Order getOrderInitialPrice(Order order){ |
| | | order.setStartDistance(0D);//起步里程 |
| | | order.setStartPrice(0D);//起步价 |
| | | order.setOverDriveDistance(0D);//超出起步里程 |
| | | order.setOverDrivePrice(0D);//超出起步里程费 |
| | | order.setLongDistance("");//长途里程 |
| | | order.setLongDistancePrice(0D);//长途里程费 |
| | | order.setOverLongDistance(0D);//超出长途里程 |
| | | order.setOverLongDistancePrice(0d);//超出长途里程费 |
| | | order.setWaitTime(0);//等待时长 |
| | | order.setWaitTimePrice(0D);//等待费 |
| | | order.setOutWaitTime(0);//超出等待时长 |
| | | order.setOutWaitTimePrice(0D);//超出等待时长费 |
| | | order.setBadWeatherDistance(0D);//恶劣天气里程 |
| | | order.setBadWeatherPrice(0D);//恶劣天气里程费 |
| | | order.setOverBadWeatherDistance(0D);//恶劣天气超出里程 |
| | | order.setOverBadWeatherPrice(0D);//恶劣天气超出里程费 |
| | | order.setDiscountedPrice(0D);//优惠金额 |
| | | order.setCouponId(null);//优惠券 |
| | | order.setDiscountAmount(0D);//折扣优惠金额 |
| | | order.setDiscount(0D);//折扣 |
| | | return order; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 下单操作 |
| | | * @param uid |
| | | * @param travelOrder |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil travelOrder(Integer uid, TravelOrder travelOrder) throws Exception { |
| | | List<Integer> state = Arrays.asList(101, 102, 103, 104, 105, 106, 107, 201, 401); |
| | | Order order = this.selectOne(new EntityWrapper<Order>().eq("userId", uid).eq("status", 1).in("state", state)); |
| | | if(null != order){ |
| | | return ResultUtil.error("您还有正在进行的订单"); |
| | | } |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | order = this.selectOne(new EntityWrapper<Order>().eq("userPhone", appUser.getPhone()).eq("status", 1).in("state", state)); |
| | | if(null != order){ |
| | | return ResultUtil.error("您还有正在进行的订单"); |
| | | } |
| | | |
| | | String startAddress = travelOrder.getStartAddress(); |
| | | startAddress = startAddress.replaceAll("& #40;", "("); |
| | | startAddress = startAddress.replaceAll("& #41;", ")"); |
| | | travelOrder.setStartAddress(startAddress); |
| | | if(ToolUtil.isNotEmpty(travelOrder.getEndAddress())){ |
| | | String endAddress = travelOrder.getEndAddress(); |
| | | endAddress = endAddress.replaceAll("& #40;", "("); |
| | | endAddress = endAddress.replaceAll("& #41;", ")"); |
| | | travelOrder.setEndAddress(endAddress); |
| | | } |
| | | |
| | | order = new Order(); |
| | | BeanUtils.copyProperties(travelOrder, order); |
| | | if(ToolUtil.isEmpty(travelOrder.getUserPhone())){ |
| | | order.setUserPhone(appUser.getPhone()); |
| | | order.setUserName(appUser.getNickname()); |
| | | } |
| | | order.setUserId(uid); |
| | | order.setSource(1); |
| | | order.setHallOrder(0); |
| | | order.setStatus(1); |
| | | order.setCreateTime(new Date()); |
| | | order.setState(null != travelOrder.getDriverId() ? 102 : 101); |
| | | Double d = 0D; |
| | | if(ToolUtil.isNotEmpty(travelOrder.getEndAddress())){ |
| | | Map<String, String> distance = MapUtil.getDistance(order.getStartLng() + "," + order.getStartLat(), order.getEndLng() + "," + order.getEndLat(), 1); |
| | | if(null == distance){ |
| | | return ResultUtil.error("获取预估距离出错"); |
| | | } |
| | | d = Double.valueOf(distance.get("distance")) / 1000; |
| | | order.setEstimatedMileage(d); |
| | | order.setEstimatedTime(Integer.valueOf(distance.get("duration")) / 60); |
| | | } |
| | | String city = ""; |
| | | District geocode = MapUtil.geocode(order.getStartLng(), order.getStartLat()); |
| | | if(null != geocode){ |
| | | WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>() |
| | | .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); |
| | | city = null != weatherCity ? weatherCity.getId().toString() : ""; |
| | | } |
| | | order = getOrderPrice(1, d, 0, order, city); |
| | | if(null != travelOrder.getDriverId()){ |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", travelOrder.getDriverId()).eq("status", 1)); |
| | | if(null == driverWork){ |
| | | return ResultUtil.error("司机还未上班"); |
| | | } |
| | | Driver driver = driverService.selectById(travelOrder.getDriverId()); |
| | | if(driver.getServerStatus() == 2){ |
| | | return ResultUtil.error("司机正在服务中"); |
| | | } |
| | | order.setAgentId(driver.getAgentId()); |
| | | order.setBranchOfficeId(driver.getBranchOfficeId()); |
| | | order.setOrderTakingTime(new Date()); |
| | | |
| | | driver.setServerStatus(2); |
| | | driverService.updateById(driver); |
| | | |
| | | appUser.setCancelCount(0); |
| | | appUser.setIsException(1); |
| | | appUserService.updateById(appUser); |
| | | } |
| | | |
| | | for (Integer i = 0; i < travelOrder.getDriverNum(); i++) { |
| | | order.setId(null); |
| | | order.setCode(UUIDUtil.getTimeStr() + UUIDUtil.getNumberRandom(3)); |
| | | boolean insert = this.insert(order); |
| | | if(insert){ |
| | | //推送状态 |
| | | pushUtil.pushOrderStatus(uid, 1, order.getId(), order.getState()); |
| | | if(null != order.getDriverId()){ |
| | | PushOrderInfoWarpper pushOrderInfoWarpper = new PushOrderInfoWarpper(); |
| | | pushOrderInfoWarpper.setId(order.getId()); |
| | | pushOrderInfoWarpper.setState(order.getState()); |
| | | pushUtil.pushOrderInfo(order.getDriverId(), 2, pushOrderInfoWarpper); |
| | | }else{ |
| | | //推单 |
| | | pushOrder(order.getId()); |
| | | } |
| | | } |
| | | } |
| | | return ResultUtil.success(order.getId()); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 订单推送逻辑 |
| | | */ |
| | | public void pushOrder(Long orderId){ |
| | | Order order = this.selectById(orderId); |
| | | /** |
| | | * 1.先找最大推单范围内的优推司机 -》 距离最近 |
| | | * 没有1 - 》 |
| | | * 2.按照后台推送配置在范围内查找合适司机 |
| | | * 合适司:积分 > 评分 > 距离 |
| | | * 3.司机没有接单直接将订单置入大厅 |
| | | */ |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 1)); |
| | | if(null == systemConfig){ |
| | | return; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | Double num3 = jsonObject.getDouble("num3");//推单最大范围 |
| | | Integer num4 = jsonObject.getInteger("num4");//接单时间 |
| | | String startLat = order.getStartLat(); |
| | | String startLng = order.getStartLng(); |
| | | |
| | | //1 |
| | | //找到中心点 |
| | | GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(startLng), Double.valueOf(startLat)); |
| | | Double num = num3 / 1000;//范围公里 |
| | | //构造半径 |
| | | Distance distanceR = new Distance(num, Metrics.KILOMETERS); |
| | | //画圆 |
| | | Circle circle = new Circle(geoJsonPoint, distanceR); |
| | | // 构造query对象 |
| | | Query query = Query.query(Criteria.where("location").withinSphere(circle)); |
| | | List<Location> locations = mongoTemplate.find(query, Location.class); |
| | | List<Integer> driverIds = locations.stream().map(Location::getDriverId).collect(Collectors.toList()); |
| | | Integer driver = null; |
| | | YouTuiDriver youTuiDriver1 = null; |
| | | if(driverIds.size() > 0){ |
| | | List<YouTuiDriver> youTuiDrivers = youTuiDriverService.selectList(new EntityWrapper<YouTuiDriver>().in("driverId", driverIds) |
| | | .eq("state", 2).last(" and (surplusQuantity > 0 or now() < endTime) and now() < failureTime")); |
| | | Double d = null; |
| | | for (YouTuiDriver youTuiDriver : youTuiDrivers) { |
| | | String value = redisUtil.getValue("DRIVER" + youTuiDriver.getDriverId()); |
| | | if(ToolUtil.isEmpty(value)){ |
| | | continue; |
| | | } |
| | | Driver driver1 = driverService.selectById(youTuiDriver.getDriverId()); |
| | | if(driver1.getServerStatus() == 2 || driver1.getOpenOrderQRCode() == 1){ |
| | | continue; |
| | | } |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | if(d == null || d.compareTo(wgs84) > 0){ |
| | | d = wgs84; |
| | | driver = youTuiDriver.getDriverId(); |
| | | youTuiDriver1 = youTuiDriver; |
| | | } |
| | | } |
| | | } |
| | | if(null != youTuiDriver1 && youTuiDriver1.getType() == 1){ |
| | | youTuiDriver1.setSurplusQuantity(youTuiDriver1.getSurplusQuantity() - 1); |
| | | youTuiDriverService.updateById(youTuiDriver1); |
| | | } |
| | | |
| | | //开始范围查找 |
| | | if(null == driver){ |
| | | for (int i = 1; i < 4; i++) { |
| | | if(null != driver){ |
| | | break; |
| | | } |
| | | num = jsonObject.getDouble("num" + i) / 1000;//范围公里 |
| | | //构造半径 |
| | | distanceR = new Distance(num, Metrics.KILOMETERS); |
| | | //画圆 |
| | | circle = new Circle(geoJsonPoint, distanceR); |
| | | // 构造query对象 |
| | | query = Query.query(Criteria.where("location").withinSphere(circle)); |
| | | locations = mongoTemplate.find(query, Location.class); |
| | | |
| | | driverIds = locations.stream().map(Location::getDriverId).collect(Collectors.toList()); |
| | | if(driverIds.size() > 0){ |
| | | List<Driver> drivers = driverService.selectList(new EntityWrapper<Driver>().eq("approvalStatus", 2) |
| | | .eq("serverStatus", 1).eq("openOrderQRCode", 0).eq("status", 1).in("id", driverIds)); |
| | | if(drivers.size() == 0){ |
| | | continue; |
| | | } |
| | | |
| | | Integer integral = null;//积分 |
| | | Double score = null;//评分 |
| | | Double d = null; |
| | | for (Driver driver1 : drivers) { |
| | | String value = redisUtil.getValue("DRIVER" + driver1.getId()); |
| | | if(ToolUtil.isEmpty(value)){ |
| | | continue; |
| | | } |
| | | if(integral == null || integral.compareTo(driver1.getIntegral()) < 0){//积分大 |
| | | integral = driver1.getIntegral(); |
| | | score = driver1.getScore(); |
| | | driver = driver1.getId(); |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | d = wgs84; |
| | | continue; |
| | | } |
| | | if(integral.compareTo(driver1.getIntegral()) == 0 && score.compareTo(driver1.getScore()) < 0){//积分相同对比评分 |
| | | integral = driver1.getIntegral(); |
| | | score = driver1.getScore(); |
| | | driver = driver1.getId(); |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | d = wgs84; |
| | | continue; |
| | | } |
| | | if(integral.compareTo(driver1.getIntegral()) == 0 && score.compareTo(driver1.getScore()) == 0){//积分相同/评分相同对比距离 |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | if(d.compareTo(wgs84) > 0){ |
| | | d = wgs84; |
| | | integral = driver1.getIntegral(); |
| | | score = driver1.getScore(); |
| | | driver = driver1.getId(); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(null != driver){ |
| | | pushUtil.pushGrabOrder(driver, 2, order.getId(), num4); |
| | | //创建定时任务处理订单到大厅 |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Order order1 = OrderServiceImpl.this.selectById(order.getId()); |
| | | if(order1.getState() == 101 || order1.getState() == 201){ |
| | | order1.setHallOrder(1); |
| | | OrderServiceImpl.this.updateById(order1); |
| | | } |
| | | } |
| | | }, num4 * 1000); |
| | | }else{ |
| | | order.setHallOrder(1); |
| | | this.updateById(order); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 取消订单 |
| | | * @param uid |
| | | * @param orderId |
| | | * @param cause |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil cancelOrder(Integer uid, Long orderId, String cause) throws Exception { |
| | | Order order = this.selectById(orderId); |
| | | if(order.getState() >= 105){ |
| | | return ResultUtil.error("不能取消订单"); |
| | | } |
| | | CancelOrder cancelOrder = new CancelOrder(); |
| | | cancelOrder.setOrderId(orderId); |
| | | cancelOrder.setUserType(1); |
| | | cancelOrder.setUserId(uid); |
| | | cancelOrder.setCause(cause); |
| | | cancelOrder.setStatus(1); |
| | | cancelOrder.setCreateTime(new Date()); |
| | | cancelOrderService.insert(cancelOrder); |
| | | order.setState(301); |
| | | this.updateById(order); |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | appUser.setCancelCount(appUser.getCancelCount() + 1); |
| | | if(appUser.getCancelCount() >= 3){ |
| | | appUser.setIsException(2); |
| | | } |
| | | appUserService.updateById(appUser); |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | if(null != driver){ |
| | | driver.setServerStatus(1); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | pushUtil.pushOrderStatus(uid, 1, orderId, order.getState()); |
| | | if(null != order.getDriverId()){ |
| | | PushOrderInfoWarpper pushOrderInfoWarpper = new PushOrderInfoWarpper(); |
| | | pushOrderInfoWarpper.setId(order.getId()); |
| | | pushOrderInfoWarpper.setState(order.getState()); |
| | | pushUtil.pushOrderInfo(order.getDriverId(), 2, pushOrderInfoWarpper); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取订单详情 |
| | | * @param uid |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public OrderInfoWarpper queryOrderInfo(Integer uid, Long orderId) throws Exception { |
| | | OrderInfoWarpper orderInfoWarpper = this.baseMapper.queryOrderInfo(uid, orderId); |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 7)); |
| | | if(null != systemConfig){ |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | orderInfoWarpper.setServiceCell(jsonObject.getString("num1")); |
| | | } |
| | | String value = redisUtil.getValue("DRIVER" + orderInfoWarpper.getDriverId()); |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | String[] split = value.split(","); |
| | | orderInfoWarpper.setDriverLon(split[0]); |
| | | orderInfoWarpper.setDriverLat(split[1]); |
| | | } |
| | | return orderInfoWarpper; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改订单终点 |
| | | * @param uid |
| | | * @param editOrderEndAddress |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil editOrderEndAddress(Integer uid, EditOrderEndAddress editOrderEndAddress) throws Exception { |
| | | Order order = this.selectById(editOrderEndAddress.getOrderId()); |
| | | order.setEndAddress(editOrderEndAddress.getEndAddress()); |
| | | order.setEndLat(editOrderEndAddress.getEndLat().toString()); |
| | | order.setEndLng(editOrderEndAddress.getEndLng().toString()); |
| | | Double d = 0D; |
| | | if(ToolUtil.isNotEmpty(order.getEndAddress())){ |
| | | Map<String, String> distance = MapUtil.getDistance(order.getStartLng() + "," + order.getStartLat(), |
| | | order.getEndLng() + "," + order.getEndLat(), 1); |
| | | if(null == distance){ |
| | | return ResultUtil.error("获取预估距离出错"); |
| | | } |
| | | d = Double.valueOf(distance.get("distance")) / 1000; |
| | | order.setEstimatedMileage(d); |
| | | order.setEstimatedTime(Integer.valueOf(distance.get("duration")) / 60); |
| | | } |
| | | String city = ""; |
| | | District geocode = MapUtil.geocode(order.getStartLng().toString(), order.getStartLat().toString()); |
| | | if(null != geocode){ |
| | | WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>() |
| | | .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); |
| | | city = null != weatherCity ? weatherCity.getId().toString() : ""; |
| | | } |
| | | Order order1 = new Order(); |
| | | BeanUtils.copyProperties(order, order1); |
| | | Order orderPrice = getOrderPrice(1, d, 0, order1, city); |
| | | order.setEstimatedPrice(orderPrice.getEstimatedPrice()); |
| | | this.updateById(order); |
| | | |
| | | PushOrderInfoWarpper pushOrderInfoWarpper = new PushOrderInfoWarpper(); |
| | | pushOrderInfoWarpper.setId(order.getId()); |
| | | pushOrderInfoWarpper.setState(order.getState()); |
| | | pushOrderInfoWarpper.setEndAddress(order.getEndAddress()); |
| | | pushOrderInfoWarpper.setEndLat(order.getEndLat()); |
| | | pushOrderInfoWarpper.setEndLng(order.getEndLng()); |
| | | pushUtil.pushOrderInfo(order.getDriverId(), 2, pushOrderInfoWarpper); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | /** |
| | | * 获取费用明细 |
| | | * @param uid |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public OrderPriceWarpper queryOrderPrice(Integer uid, Long orderId) throws Exception { |
| | | Order order = this.selectById(orderId); |
| | | OrderPriceWarpper orderPriceWarpper = new OrderPriceWarpper(); |
| | | BeanUtils.copyProperties(order, orderPriceWarpper); |
| | | orderPriceWarpper.setActualMileage(new BigDecimal(order.getActualMileage() / 1000).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | orderPriceWarpper.setTravelTime(Double.valueOf((order.getGetoffTime().getTime() - order.getStartTime().getTime()) / 60000).intValue()); |
| | | return orderPriceWarpper; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 重新计算费用明细 |
| | | * @param orderId |
| | | * @param couponId |
| | | * @param payType |
| | | * @param balance |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public OrderPriceWarpper calculationOfExpenses(Integer uid, Long orderId, Integer couponId, Integer payType, Double balance) throws Exception { |
| | | Order order = this.selectById(orderId); |
| | | OrderPriceWarpper orderPriceWarpper = new OrderPriceWarpper(); |
| | | BeanUtils.copyProperties(order, orderPriceWarpper); |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | orderPriceWarpper.setActualMileage(new BigDecimal(order.getActualMileage() / 1000).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | orderPriceWarpper.setTravelTime(Double.valueOf((order.getGetoffTime().getTime() - order.getStartTime().getTime()) / 60000).intValue()); |
| | | orderPriceWarpper.setBalance(appUser.getAccountBalance()); |
| | | orderPriceWarpper.setDiscount(0D); |
| | | orderPriceWarpper.setDiscountAmount(0D); |
| | | orderPriceWarpper.setPayType(1);//微信支付 |
| | | Double orderMoney = order.getOrderMoney(); |
| | | //先算优惠券 |
| | | // Coupon coupon = userToCouponService.queryCoupon(uid, orderMoney); |
| | | // if(null != coupon && null == couponId){ |
| | | // orderPriceWarpper.setDiscountedPrice(coupon.getCouponPreferentialAmount()); |
| | | // orderPriceWarpper.setCouponId(coupon.getId()); |
| | | // } |
| | | if(payType == 1 && null == couponId && appUser.getHavDiscount() == 1 && balance.compareTo(orderMoney) >= 0){//使用余额抵扣 |
| | | orderPriceWarpper.setDiscount(9D); |
| | | orderPriceWarpper.setDiscountAmount(new BigDecimal(orderMoney * 0.1).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | orderMoney = new BigDecimal(orderMoney * 0.9).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | } |
| | | if(null != couponId){ |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(couponId); |
| | | Coupon coupon1 = couponService.selectById(userToCoupon.getCouponId()); |
| | | orderMoney = orderMoney - coupon1.getCouponPreferentialAmount(); |
| | | orderPriceWarpper.setDiscountedPrice(coupon1.getCouponPreferentialAmount()); |
| | | orderPriceWarpper.setCouponId(couponId); |
| | | } |
| | | if(payType == 0){//不使用余额抵扣 |
| | | orderPriceWarpper.setPayType(1); |
| | | } |
| | | if(payType == 1 && balance.compareTo(orderMoney) >= 0){//使用余额抵扣 |
| | | orderPriceWarpper.setPayType(2); |
| | | } |
| | | if(payType == 1 && balance.compareTo(orderMoney) < 0){//使用余额抵扣部分 |
| | | orderPriceWarpper.setPayType(4); |
| | | } |
| | | |
| | | orderPriceWarpper.setPayMoney(orderMoney); |
| | | return orderPriceWarpper; |
| | | } |
| | | |
| | | /** |
| | | * 获取订单支付页面优惠券列表 |
| | | * @param uid |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<CouponWarpper> queryPayCouponList(Integer uid, Long orderId) throws Exception { |
| | | Order order = this.selectById(orderId); |
| | | return userToCouponService.queryPayCouponList(uid, order.getOrderMoney()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付订单操作 |
| | | * @param uid |
| | | * @param orderPayment |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil orderPayment(Integer uid, OrderPayment orderPayment) throws Exception { |
| | | Order order = this.selectById(orderPayment.getOrderId()); |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | if(order.getState() != 107){ |
| | | return ResultUtil.error("不允许支付"); |
| | | } |
| | | if(orderPayment.getPayType() == 2){ |
| | | Double payMoney = order.getOrderMoney() * (appUser.getHavDiscount() == 1 ? 0.9 : 1); |
| | | if(appUser.getAccountBalance() < payMoney){ |
| | | return ResultUtil.error("账户余额不足"); |
| | | } |
| | | } |
| | | //开始支付操作 |
| | | if(orderPayment.getPayType() == 1){//微信支付 |
| | | return weixinPay(order, appUser, orderPayment.getCouponId()); |
| | | } |
| | | if(orderPayment.getPayType() == 2){//余额支付 |
| | | return balancePayment(order, appUser, orderPayment.getCouponId()); |
| | | } |
| | | if(orderPayment.getPayType() == 3){//线下支付(由司机端操作) |
| | | } |
| | | if(orderPayment.getPayType() == 4){//微信+余额 |
| | | return weixinAndBalancePayment(order, appUser, orderPayment.getCouponId()); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信支付 |
| | | * @param order |
| | | * @param appUser |
| | | * @param couponId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public ResultUtil weixinPay(Order order, AppUser appUser, Integer couponId) throws Exception{ |
| | | Double payMoney = order.getOrderMoney(); |
| | | if(null != couponId){ |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(couponId); |
| | | if(userToCoupon.getValidCount() > 0){ |
| | | userToCoupon.setValidCount(userToCoupon.getValidCount() - 1); |
| | | userToCouponService.updateById(userToCoupon); |
| | | Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); |
| | | payMoney = payMoney - coupon.getCouponPreferentialAmount(); |
| | | order.setCouponId(coupon.getId()); |
| | | order.setDiscountedPrice(coupon.getCouponPreferentialAmount()); |
| | | userToCouponService.updateById(userToCoupon); |
| | | } |
| | | } |
| | | order.setPayType(1); |
| | | order.setPayMoney(payMoney); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String out_trade_no = sdf.format(new Date()) + order.getId(); |
| | | // ResultUtil weixinpay = payMoneyUtil.weixinpay("代驾服务费", "", out_trade_no, payMoney.toString(), "/base/order/orderPayCallback", "JSAPI", appUser.getOpenid()); |
| | | // this.updateById(order); |
| | | |
| | | |
| | | |
| | | PaymentOrder paymentOrder = new PaymentOrder(); |
| | | paymentOrder.setBizOrderId(out_trade_no); |
| | | paymentOrder.setAmount(String.valueOf(payMoney * 100)); |
| | | paymentOrder.setOrderName("代驾服务费"); |
| | | paymentOrder.setPayType("WX_MINI"); |
| | | paymentOrder.setTransferType("0"); |
| | | paymentOrder.setAsynSplitFlag("1"); |
| | | paymentOrder.setAppid(""); |
| | | paymentOrder.setOpenid(appUser.getOpenid()); |
| | | paymentOrder.setTerminalIp(InetAddress.getLocalHost().getHostAddress()); |
| | | List<PaymentOrderGood> goodsDetail = new ArrayList<>(); |
| | | PaymentOrderGood paymentOrderGood = new PaymentOrderGood(); |
| | | paymentOrderGood.setGoodsName("服务费"); |
| | | goodsDetail.add(paymentOrderGood); |
| | | paymentOrder.setGoodsDetail(goodsDetail); |
| | | paymentOrder.setFrontUrl(""); |
| | | paymentOrder.setNotifyUrl(callbackPath + "/base/order/orderPayCallback"); |
| | | paymentOrder.setParameter1(order.getId().toString()); |
| | | |
| | | TrhRequest<PaymentOrder> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(paymentOrder, PaymentOrder.SERVICE_CODE); |
| | | if(!"0000".equals(execute.getResult())){ |
| | | return ResultUtil.error(execute.getMsg()); |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | String status = jsonObject.getString("status"); |
| | | if("2".equals(status)){ |
| | | return ResultUtil.error("失败"); |
| | | } |
| | | if("0".equals(status)){ |
| | | return ResultUtil.error("处理中"); |
| | | } |
| | | String payCode = jsonObject.getString("payCode"); |
| | | this.updateById(order); |
| | | return ResultUtil.success(payCode); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 账户余额支付 |
| | | * @param order |
| | | * @param appUser |
| | | * @return |
| | | */ |
| | | public ResultUtil balancePayment(Order order, AppUser appUser, Integer couponId) throws Exception{ |
| | | Double payMoney = order.getOrderMoney(); |
| | | if(null != couponId){ |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(couponId); |
| | | if(userToCoupon.getValidCount() > 0){ |
| | | userToCoupon.setValidCount(userToCoupon.getValidCount() - 1); |
| | | userToCouponService.updateById(userToCoupon); |
| | | Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); |
| | | payMoney = payMoney - coupon.getCouponPreferentialAmount(); |
| | | order.setCouponId(coupon.getId()); |
| | | order.setDiscountedPrice(coupon.getCouponPreferentialAmount()); |
| | | |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(7); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setExplain("优惠券收入"); |
| | | driver.setCouponBalance(driver.getCouponBalance() + coupon.getCouponPreferentialAmount()); |
| | | accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | } |
| | | } |
| | | |
| | | if(appUser.getHavDiscount() == 1){//9折 |
| | | payMoney = payMoney * 0.9; |
| | | order.setDiscount(9D); |
| | | order.setDiscountAmount(payMoney * 0.1); |
| | | } |
| | | |
| | | order.setPayType(2); |
| | | order.setPayMoney(payMoney); |
| | | order.setPayTime(new Date()); |
| | | order.setState(108); |
| | | this.updateById(order); |
| | | |
| | | pushUtil.pushOrderStatus(order.getUserId(), 1, order.getId(), order.getState()); |
| | | if(null != order.getDriverId()) { |
| | | PushOrderInfoWarpper pushOrderInfoWarpper = new PushOrderInfoWarpper(); |
| | | pushOrderInfoWarpper.setId(order.getId()); |
| | | pushOrderInfoWarpper.setState(order.getState()); |
| | | pushUtil.pushOrderInfo(order.getDriverId(), 2, pushOrderInfoWarpper); |
| | | } |
| | | |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(1); |
| | | accountChangeDetail.setUserId(appUser.getId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setOldData(appUser.getAccountBalance()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(2); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setExplain("代驾服务费"); |
| | | appUser.setAccountBalance(appUser.getAccountBalance() - payMoney); |
| | | accountChangeDetail.setNewData(appUser.getAccountBalance()); |
| | | appUserService.updateById(appUser); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | |
| | | //处理佣金和收入记录 |
| | | saveCommission(order); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信+账户余额支付 |
| | | * @param order |
| | | * @param appUser |
| | | * @param couponId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public ResultUtil weixinAndBalancePayment(Order order, AppUser appUser, Integer couponId) throws Exception{ |
| | | Double payMoney = order.getOrderMoney(); |
| | | if(null != couponId){ |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(couponId); |
| | | if(userToCoupon.getValidCount() > 0){ |
| | | userToCoupon.setValidCount(userToCoupon.getValidCount() - 1); |
| | | userToCouponService.updateById(userToCoupon); |
| | | Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); |
| | | payMoney = payMoney - coupon.getCouponPreferentialAmount(); |
| | | order.setCouponId(coupon.getId()); |
| | | order.setDiscountedPrice(coupon.getCouponPreferentialAmount()); |
| | | } |
| | | } |
| | | order.setPayType(1); |
| | | order.setPayMoney(payMoney); |
| | | |
| | | payMoney = payMoney > appUser.getAccountBalance() ? payMoney - appUser.getAccountBalance() : 0D; |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(1); |
| | | accountChangeDetail.setUserId(appUser.getId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setOldData(appUser.getAccountBalance()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(2); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setExplain("代驾服务费"); |
| | | appUser.setAccountBalance(appUser.getAccountBalance() > payMoney ? appUser.getAccountBalance() - payMoney : 0); |
| | | accountChangeDetail.setNewData(appUser.getAccountBalance()); |
| | | appUserService.updateById(appUser); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | |
| | | if(0 < payMoney){//还需要调起微信支付 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String out_trade_no = sdf.format(new Date()) + order.getId(); |
| | | // ResultUtil weixinpay = payMoneyUtil.weixinpay("代驾服务费", "", out_trade_no, payMoney.toString(), "/base/order/orderPayCallback", "JSAPI", appUser.getOpenid()); |
| | | |
| | | PaymentOrder paymentOrder = new PaymentOrder(); |
| | | paymentOrder.setBizOrderId(out_trade_no); |
| | | paymentOrder.setAmount(String.valueOf(payMoney * 100)); |
| | | paymentOrder.setOrderName("代驾服务费"); |
| | | paymentOrder.setPayType("WX_MINI"); |
| | | paymentOrder.setTransferType("0"); |
| | | paymentOrder.setAsynSplitFlag("1"); |
| | | paymentOrder.setAppid(""); |
| | | paymentOrder.setOpenid(appUser.getOpenid()); |
| | | paymentOrder.setTerminalIp(InetAddress.getLocalHost().getHostAddress()); |
| | | List<PaymentOrderGood> goodsDetail = new ArrayList<>(); |
| | | PaymentOrderGood paymentOrderGood = new PaymentOrderGood(); |
| | | paymentOrderGood.setGoodsName("服务费"); |
| | | goodsDetail.add(paymentOrderGood); |
| | | paymentOrder.setGoodsDetail(goodsDetail); |
| | | paymentOrder.setFrontUrl(""); |
| | | paymentOrder.setNotifyUrl(callbackPath + "/base/order/orderPayCallback"); |
| | | paymentOrder.setParameter1(order.getId().toString()); |
| | | |
| | | TrhRequest<PaymentOrder> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(paymentOrder, PaymentOrder.SERVICE_CODE); |
| | | if(!"0000".equals(execute.getResult())){ |
| | | return ResultUtil.error(execute.getMsg()); |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | String status = jsonObject.getString("status"); |
| | | if("2".equals(status)){ |
| | | return ResultUtil.error("失败"); |
| | | } |
| | | if("0".equals(status)){ |
| | | return ResultUtil.error("处理中"); |
| | | } |
| | | String payCode = jsonObject.getString("payCode"); |
| | | this.updateById(order); |
| | | return ResultUtil.success(payCode); |
| | | |
| | | // TODO: 2023/5/18 取消支付后需要处理优惠券数据回退 |
| | | // |
| | | // |
| | | // new Thread(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // try { |
| | | // int num = 1; |
| | | // int wait = 0; |
| | | // while (num <= 10){ |
| | | // int min = 5000; |
| | | // wait += (min * num); |
| | | // Order order1 = OrderServiceImpl.this.selectById(order.getId()); |
| | | // if(order1.getState() != 107){ |
| | | // return; |
| | | // } |
| | | // |
| | | // /** |
| | | // * SUCCESS--支付成功 |
| | | // * REFUND--转入退款 |
| | | // * NOTPAY--未支付 |
| | | // * CLOSED--已关闭 |
| | | // * REVOKED--已撤销(刷卡支付) |
| | | // * USERPAYING--用户支付中 |
| | | // * PAYERROR--支付失败(其他原因,如银行返回失败) |
| | | // * ACCEPT--已接收,等待扣款 |
| | | // */ |
| | | // ResultUtil<Map<String, String>> resultUtil = payMoneyUtil.queryWXOrder(out_trade_no, ""); |
| | | // if(resultUtil.getCode() == 200){ |
| | | // Map<String, String> map = resultUtil.getData(); |
| | | // String trade_type = map.get("trade_type"); |
| | | // String trade_state = map.get("trade_state"); |
| | | // String transaction_id = map.get("transaction_id"); |
| | | // if("REFUND".equals(trade_state) || "NOTPAY".equals(trade_state) || "CLOSED".equals(trade_state) || "REVOKED".equals(trade_state) || "PAYERROR".equals(trade_state)){ |
| | | // AccountChangeDetail accountChangeDetail1 = accountChangeDetailService.selectById(accountChangeDetail.getId()); |
| | | // AppUser appUser1 = appUserService.selectById(accountChangeDetail1.getUserId()); |
| | | // Double b = accountChangeDetail1.getOldData() - accountChangeDetail1.getNewData(); |
| | | // appUser1.setAccountBalance(appUser1.getAccountBalance() + b); |
| | | // appUserService.updateById(appUser1); |
| | | // |
| | | // accountChangeDetailService.deleteById(accountChangeDetail.getId()); |
| | | // return; |
| | | // } |
| | | // if("SUCCESS".equals(trade_state)){ |
| | | // order1.setPayTime(new Date()); |
| | | // order1.setState(108); |
| | | // order1.setOrderNo(transaction_id); |
| | | // OrderServiceImpl.this.updateById(order1); |
| | | // |
| | | // //处理抽成及收入 |
| | | // saveCommission(order1); |
| | | // return; |
| | | // } |
| | | // if("USERPAYING".equals(trade_state) || "ACCEPT".equals(trade_state)){ |
| | | // Thread.sleep(wait); |
| | | // num++; |
| | | // } |
| | | // }else{ |
| | | // Thread.sleep(wait); |
| | | // num++; |
| | | // } |
| | | // if(10 == num){ |
| | | // AccountChangeDetail accountChangeDetail1 = accountChangeDetailService.selectById(accountChangeDetail.getId()); |
| | | // AppUser appUser1 = appUserService.selectById(accountChangeDetail1.getUserId()); |
| | | // Double b = accountChangeDetail1.getOldData() - accountChangeDetail1.getNewData(); |
| | | // appUser1.setAccountBalance(appUser1.getAccountBalance() + b); |
| | | // appUserService.updateById(appUser1); |
| | | // |
| | | // accountChangeDetailService.deleteById(accountChangeDetail.getId()); |
| | | // } |
| | | // } |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // }).start(); |
| | | // return weixinpay; |
| | | } |
| | | // order.setPayTime(new Date()); |
| | | // this.updateById(order); |
| | | |
| | | |
| | | return ResultUtil.success(); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 订单微信支付回调 |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil orderPayCallback(String orderId, String transaction_id) throws Exception { |
| | | Order order = this.selectById(orderId); |
| | | if(order.getState() != 107){ |
| | | return ResultUtil.success(); |
| | | } |
| | | order.setState(108); |
| | | order.setPayTime(new Date()); |
| | | order.setOrderNo(transaction_id); |
| | | this.updateById(order); |
| | | //添加收入明细 |
| | | saveCommission(order); |
| | | |
| | | pushUtil.pushOrderStatus(order.getUserId(), 1, order.getId(), order.getState()); |
| | | if(null != order.getDriverId()) { |
| | | PushOrderInfoWarpper pushOrderInfoWarpper = new PushOrderInfoWarpper(); |
| | | pushOrderInfoWarpper.setId(order.getId()); |
| | | pushOrderInfoWarpper.setState(order.getState()); |
| | | pushUtil.pushOrderInfo(order.getDriverId(), 2, pushOrderInfoWarpper); |
| | | } |
| | | |
| | | //支付成功---->异步分账----->10s钟后再进行确认收货 |
| | | //确认收货后才能进行提现(结算接口) |
| | | //异步分账 |
| | | List<Revenue> revenues = revenueService.selectList(new EntityWrapper<Revenue>().eq("orderId", order.getId())); |
| | | Complete complete = new Complete(); |
| | | complete.setOriginalMerOrderId(transaction_id); |
| | | complete.setNotifyUrl(callbackPath + "/base/order/ledgerCallback"); |
| | | List<PamentOrderUser> splitList = new ArrayList<>(); |
| | | for (Revenue revenue : revenues) { |
| | | if(revenue.getUserType() == 2){//司机 |
| | | Driver driver = driverService.selectById(revenue.getUserId()); |
| | | PamentOrderUser pamentOrderUser = new PamentOrderUser(); |
| | | pamentOrderUser.setSplitUserId(driver.getMerchantNumber()); |
| | | pamentOrderUser.setSplitAmount(revenue.getAmount().toString()); |
| | | pamentOrderUser.setSplitType("2"); |
| | | splitList.add(pamentOrderUser); |
| | | |
| | | DivisionRecord divisionRecord = new DivisionRecord(); |
| | | divisionRecord.setUserType(1); |
| | | divisionRecord.setUserId(revenue.getUserId()); |
| | | divisionRecord.setOrderId(order.getId()); |
| | | divisionRecord.setMerOrderId(transaction_id); |
| | | divisionRecord.setSourceType(1); |
| | | divisionRecord.setAmount(revenue.getAmount()); |
| | | divisionRecord.setMerchantNumber(driver.getMerchantNumber()); |
| | | divisionRecord.setState(1); |
| | | divisionRecord.setCreateTime(new Date()); |
| | | divisionRecordService.insert(divisionRecord); |
| | | } |
| | | if(revenue.getUserType() == 3){//代理商 |
| | | Agent agent = agentService.selectById(revenue.getUserId()); |
| | | PamentOrderUser pamentOrderUser = new PamentOrderUser(); |
| | | pamentOrderUser.setSplitUserId(agent.getMerchantNumber()); |
| | | pamentOrderUser.setSplitAmount(revenue.getAmount().toString()); |
| | | pamentOrderUser.setSplitType("2"); |
| | | splitList.add(pamentOrderUser); |
| | | |
| | | DivisionRecord divisionRecord = new DivisionRecord(); |
| | | divisionRecord.setUserType(2); |
| | | divisionRecord.setUserId(revenue.getUserId()); |
| | | divisionRecord.setOrderId(order.getId()); |
| | | divisionRecord.setMerOrderId(transaction_id); |
| | | divisionRecord.setSourceType(1); |
| | | divisionRecord.setAmount(revenue.getAmount()); |
| | | divisionRecord.setMerchantNumber(agent.getMerchantNumber()); |
| | | divisionRecord.setState(1); |
| | | divisionRecord.setCreateTime(new Date()); |
| | | divisionRecordService.insert(divisionRecord); |
| | | } |
| | | |
| | | } |
| | | complete.setSplitList(splitList); |
| | | TrhRequest<Complete> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(complete, Complete.SERVICE_CODE); |
| | | if(!"0000".equals(execute.getResult())){ |
| | | return ResultUtil.error(execute.getMsg()); |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | String status = jsonObject.getString("status"); |
| | | if("2".equals(status)){ |
| | | return ResultUtil.error("失败"); |
| | | } |
| | | if("0".equals(status)){ |
| | | return ResultUtil.error("处理中"); |
| | | } |
| | | |
| | | //使用优惠券的情况,通过转账接口将优惠券的收入转到司机电子账簿 |
| | | if(null != order.getCouponId()){ |
| | | List<PlatformRechargeRecord> platformRechargeRecords = platformRechargeRecordService.selectList(new EntityWrapper<PlatformRechargeRecord>().eq("state", 2).last(" and balance > 0 order by payTime")); |
| | | Double discountedPrice = order.getDiscountedPrice(); |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(order.getCouponId()); |
| | | Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(7); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setExplain("优惠券收入"); |
| | | driver.setCouponBalance(driver.getCouponBalance() + coupon.getCouponPreferentialAmount()); |
| | | accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | |
| | | |
| | | for (PlatformRechargeRecord platformRechargeRecord : platformRechargeRecords) { |
| | | if(discountedPrice == 0){ |
| | | break; |
| | | } |
| | | |
| | | if(platformRechargeRecord.getBalance().compareTo(discountedPrice) >= 0){ |
| | | discountedPrice = 0D; |
| | | platformRechargeRecord.setBalance(platformRechargeRecord.getBalance() - discountedPrice); |
| | | platformRechargeRecordService.updateById(platformRechargeRecord); |
| | | }else{ |
| | | |
| | | } |
| | | |
| | | Transfer transfer = new Transfer(); |
| | | transfer.setDepositMerOrderId("6831518911582834611"); |
| | | transfer.setToUserId(driver.getMerchantNumber()); |
| | | transfer.setAmount(discountedPrice.toString()); |
| | | transfer.setOrderName(""); |
| | | transfer.setNotifyUrl(""); |
| | | transfer.setParameter1(order.getId().toString()); |
| | | |
| | | TrhRequest<Transfer> request1 = new TrhRequest(); |
| | | InterfaceResponse execute1 = request1.execute(transfer, Transfer.SERVICE_CODE); |
| | | if(!"0000".equals(execute1.getResult())){ |
| | | return ResultUtil.error(execute1.getMsg()); |
| | | } |
| | | JSONObject jsonObject1 = JSON.parseObject(execute1.getResult()); |
| | | String status1 = jsonObject1.getString("status"); |
| | | if("2".equals(status1)){ |
| | | return ResultUtil.error("失败"); |
| | | } |
| | | if("0".equals(status1)){ |
| | | return ResultUtil.error("处理中"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 订单评价 |
| | | * @param uid |
| | | * @param orderId |
| | | * @param score |
| | | * @param content |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil orderAppraise(Integer uid, Long orderId, Integer score, String content) throws Exception { |
| | | Order order = this.selectById(orderId); |
| | | if(order.getState() != 108){ |
| | | return ResultUtil.error("不能进行评价"); |
| | | } |
| | | order.setState(109); |
| | | this.updateById(order); |
| | | Evaluate evaluate = new Evaluate(); |
| | | evaluate.setOrderId(orderId.intValue()); |
| | | evaluate.setCreateTime(new Date()); |
| | | evaluate.setScore(score); |
| | | evaluate.setEvaluate(content); |
| | | evaluate.setStatus(1); |
| | | evaluate.setUserId(uid); |
| | | evaluateService.insert(evaluate); |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | driver.setScore(((null == driver.getScore() ? 0 : driver.getScore()) + score) / 2); |
| | | if(score == 5){//司机积分奖励 |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4)); |
| | | if(null != systemConfig){ |
| | | //{"num1":"10:00","num2":"14:00","num3":10,"num4":10,"num5":10,"num6":10,"num7":10,"num8":10,"num9":5,"num10":5} |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | Integer num5 = jsonObject.getInteger("num5"); |
| | | |
| | | //增加积分变动记录 |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setOldData(driver.getIntegral().doubleValue()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setExplain("代驾5星好评"); |
| | | driver.setIntegral(driver.getIntegral() + num5); |
| | | accountChangeDetail.setNewData(driver.getIntegral().doubleValue()); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | } |
| | | } |
| | | if(score < 3){//差评扣减积分 |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4)); |
| | | if(null != systemConfig){ |
| | | //{"num1":"10:00","num2":"14:00","num3":10,"num4":10,"num5":10,"num6":10,"num7":10,"num8":10,"num9":5,"num10":5} |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | Integer num9 = jsonObject.getInteger("num9"); |
| | | |
| | | //增加积分变动记录 |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setOldData(driver.getIntegral().doubleValue()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setExplain("差评扣减积分"); |
| | | driver.setIntegral(driver.getIntegral() - num9); |
| | | accountChangeDetail.setNewData(driver.getIntegral().doubleValue()); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | } |
| | | } |
| | | driverService.updateById(driver); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 处理订单收入及分佣抽成 |
| | | * @param order |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public void saveCommission(Order order) throws Exception{ |
| | | //司机收入和代理商抽成(先分佣,后抽成) |
| | | //司机分佣和司机推荐用户首单奖励都在平台的抽佣中扣除,剩余的为平台抽佣。 |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | AppUser appUser = appUserService.selectById(order.getUserId()); |
| | | Double payMoney = order.getPayMoney(); |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 3)); |
| | | if(null != systemConfig){ |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | Double num2 = jsonObject.getDouble("num2"); |
| | | Double num3 = jsonObject.getDouble("num3"); |
| | | if(order.getPayMoney() >= num2){ |
| | | payMoney = payMoney - num3;//司机收入 |
| | | SystemConfig systemConfig1 = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 2)); |
| | | if(null != systemConfig1){ |
| | | JSONObject jsonObject1 = JSON.parseObject(systemConfig1.getContent()); |
| | | //司机推荐首单收入 |
| | | List<Integer> state = Arrays.asList(108, 109); |
| | | int count = this.selectCount(new EntityWrapper<Order>().eq("userId", appUser.getId()).eq("status", 1).in("state", state)); |
| | | if(null != appUser.getInviterType() && appUser.getInviterType() == 2 && count == 1){ |
| | | Double num1 = jsonObject1.getDouble("num1"); |
| | | num1 = (num3 >= num1 ? num1 : num3); |
| | | |
| | | if(num1 > 0){ |
| | | Driver driver1 = driverService.selectById(appUser.getInviterId()); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num1); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | driverService.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | |
| | | Revenue revenue = new Revenue(); |
| | | revenue.setType(2); |
| | | revenue.setUserType(2); |
| | | revenue.setUserId(driver1.getId()); |
| | | revenue.setOrderId(order.getId()); |
| | | revenue.setAmount(num1); |
| | | revenue.setCreateTime(new Date()); |
| | | revenueService.insert(revenue); |
| | | } |
| | | num3 = (num3 >= num1 ? num3 - num1 : 0); |
| | | } |
| | | |
| | | //开始处理层级抽佣 |
| | | if(null != driver & null != driver.getInviterType() && driver.getInviterType() == 2){ |
| | | Driver driver1 = driverService.selectById(driver.getInviterId());//一级司机 |
| | | if(null != driver1 && null != driver1.getInviterType() && driver1.getInviterType() == 2){ |
| | | Driver driver2 = driverService.selectById(driver1.getInviterId());//二级司机 |
| | | if(null != driver2 && null != driver2.getInviterType() && driver2.getInviterType() == 2){ |
| | | Driver driver3 = driverService.selectById(driver2.getInviterId());//三级级司机 |
| | | Double num5 = jsonObject1.getDouble("num5"); |
| | | Double num6 = jsonObject1.getDouble("num6"); |
| | | Double num7 = jsonObject1.getDouble("num7"); |
| | | num5 = (num3 >= num5 ? num5 : num3); |
| | | if(num5 > 0 && null != driver1){ |
| | | Revenue revenue = new Revenue(); |
| | | revenue.setType(2); |
| | | revenue.setUserType(2); |
| | | revenue.setUserId(driver1.getId()); |
| | | revenue.setOrderId(order.getId()); |
| | | revenue.setAmount(num5); |
| | | revenue.setCreateTime(new Date()); |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num5); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | driverService.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num5 ? num3 - num5 : 0); |
| | | } |
| | | num6 = (num3 >= num6 ? num6 : num3); |
| | | if(num6 > 0 && null != driver2){ |
| | | Revenue revenue = new Revenue(); |
| | | revenue.setType(2); |
| | | revenue.setUserType(2); |
| | | revenue.setUserId(driver2.getId()); |
| | | revenue.setOrderId(order.getId()); |
| | | revenue.setAmount(num6); |
| | | revenue.setCreateTime(new Date()); |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver2.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver2.setCommission(driver2.getCommission() + num6); |
| | | accountChangeDetail.setNewData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); |
| | | driverService.updateById(driver2); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num6 ? num3 - num6 : 0); |
| | | } |
| | | num7 = (num3 >= num7 ? num7 : num3); |
| | | if(num7 > 0 && null != driver3){ |
| | | Revenue revenue = new Revenue(); |
| | | revenue.setType(2); |
| | | revenue.setUserType(2); |
| | | revenue.setUserId(driver3.getId()); |
| | | revenue.setOrderId(order.getId()); |
| | | revenue.setAmount(num7); |
| | | revenue.setCreateTime(new Date()); |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver3.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver3.getBalance() + driver3.getBackgroundBalance() + driver3.getCouponBalance() + driver3.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver3.setCommission(driver3.getCommission() + num7); |
| | | accountChangeDetail.setNewData(driver3.getBalance() + driver3.getBackgroundBalance() + driver3.getCouponBalance() + driver3.getCommission()); |
| | | driverService.updateById(driver3); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num7 ? num3 - num7 : 0); |
| | | } |
| | | }else{ |
| | | Double num3_ = jsonObject1.getDouble("num3"); |
| | | Double num4 = jsonObject1.getDouble("num4"); |
| | | num3_ = (num3 >= num3_ ? num3_ : num3); |
| | | if(num3_ > 0 && null != driver1){ |
| | | Revenue revenue = new Revenue(); |
| | | revenue.setType(2); |
| | | revenue.setUserType(2); |
| | | revenue.setUserId(driver1.getId()); |
| | | revenue.setOrderId(order.getId()); |
| | | revenue.setAmount(num3_); |
| | | revenue.setCreateTime(new Date()); |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num3_); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | driverService.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num3_ ? num3 - num3_ : 0); |
| | | } |
| | | num4 = (num3 >= num4 ? num4 : num3); |
| | | if(num4 > 0 && null != driver2){ |
| | | Revenue revenue = new Revenue(); |
| | | revenue.setType(2); |
| | | revenue.setUserType(2); |
| | | revenue.setUserId(driver2.getId()); |
| | | revenue.setOrderId(order.getId()); |
| | | revenue.setAmount(num4); |
| | | revenue.setCreateTime(new Date()); |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver2.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver2.setCommission(driver2.getCommission() + num4); |
| | | accountChangeDetail.setNewData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); |
| | | driverService.updateById(driver2); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num4 ? num3 - num4 : 0); |
| | | } |
| | | } |
| | | }else{ |
| | | Double num2_ = jsonObject1.getDouble("num2"); |
| | | num2_ = (num3 >= num2_ ? num2_ : num3); |
| | | if(num2_ > 0 && null != driver1){ |
| | | Revenue revenue = new Revenue(); |
| | | revenue.setType(2); |
| | | revenue.setUserType(2); |
| | | revenue.setUserId(driver1.getId()); |
| | | revenue.setOrderId(order.getId()); |
| | | revenue.setAmount(num2_); |
| | | revenue.setCreateTime(new Date()); |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num2_); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | driverService.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num2_ ? num3 - num2_ : 0); |
| | | } |
| | | } |
| | | } |
| | | //处理代理商抽佣 |
| | | if(num3 > 0 && null != driver){ |
| | | Revenue revenue = new Revenue(); |
| | | revenue.setType(1); |
| | | revenue.setUserType(3); |
| | | revenue.setUserId(driver.getAgentId()); |
| | | revenue.setOrderId(order.getId()); |
| | | revenue.setAmount(num3); |
| | | revenue.setCreateTime(new Date()); |
| | | revenueService.insert(revenue); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //司机订单收入 |
| | | Revenue revenue = new Revenue(); |
| | | revenue.setType(1); |
| | | revenue.setUserType(2); |
| | | revenue.setUserId(driver.getId()); |
| | | revenue.setOrderId(order.getId()); |
| | | revenue.setAmount(payMoney + order.getDiscountedPrice()); |
| | | revenue.setCreateTime(new Date()); |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(1); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setExplain("订单收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver.setBalance(driver.getBalance() + payMoney); |
| | | if(null != order.getCouponId()){ |
| | | driver.setCouponBalance(driver.getCouponBalance() + order.getDiscountedPrice()); |
| | | } |
| | | accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取乘客行程 |
| | | * @param uid |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<OrderListWarpper> queryMyOrder(Integer uid, Integer pageNum, Integer pageSize) throws Exception { |
| | | pageNum = (pageNum - 1) * pageSize; |
| | | return this.baseMapper.queryMyOrder(uid, pageNum, pageSize); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取未开票订单 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<OrderListWarpper> queryNotInvoiceOrder(Integer uid, NotInvoiceOrder notInvoiceOrder) throws Exception { |
| | | notInvoiceOrder.setPageNum((notInvoiceOrder.getPageNum() - 1) * notInvoiceOrder.getPageSize());; |
| | | return this.baseMapper.queryNotInvoiceOrder(uid, notInvoiceOrder); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.PlatformRechargeRecordMapper; |
| | | import com.agentdriving.user.modular.system.model.PlatformRechargeRecord; |
| | | import com.agentdriving.user.modular.system.service.IPlatformRechargeRecordService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/5/6 14:11 |
| | | */ |
| | | @Service |
| | | public class PlatformRechargeRecordServiceImpl extends ServiceImpl<PlatformRechargeRecordMapper, PlatformRechargeRecord> implements IPlatformRechargeRecordService { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.RechargeRecordMapper; |
| | | import com.agentdriving.user.modular.system.model.RechargeRecord; |
| | | import com.agentdriving.user.modular.system.service.IRechargeRecordService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/23 14:57 |
| | | */ |
| | | @Service |
| | | public class RechargeRecordServiceImpl extends ServiceImpl<RechargeRecordMapper, RechargeRecord> implements IRechargeRecordService { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.RelationMapper; |
| | | import com.agentdriving.user.modular.system.model.Relation; |
| | | import com.agentdriving.user.modular.system.service.IRelationService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 角色和菜单关联表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author stylefeng123 |
| | | * @since 2018-02-22 |
| | | */ |
| | | @Service |
| | | public class RelationServiceImpl extends ServiceImpl<RelationMapper, Relation> implements IRelationService { |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.RevenueMapper; |
| | | import com.agentdriving.user.modular.system.model.Revenue; |
| | | import com.agentdriving.user.modular.system.service.IRevenueService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/13 10:09 |
| | | */ |
| | | @Service |
| | | public class RevenueServiceImpl extends ServiceImpl<RevenueMapper, Revenue> implements IRevenueService { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.core.node.ZTreeNode; |
| | | import com.agentdriving.user.core.util.Convert; |
| | | import com.agentdriving.user.modular.system.dao.RelationMapper; |
| | | import com.agentdriving.user.modular.system.dao.RoleMapper; |
| | | import com.agentdriving.user.modular.system.model.Relation; |
| | | import com.agentdriving.user.modular.system.model.Role; |
| | | import com.agentdriving.user.modular.system.service.IRoleService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IRoleService { |
| | | |
| | | @Resource |
| | | private RoleMapper roleMapper; |
| | | |
| | | @Resource |
| | | private RelationMapper relationMapper; |
| | | |
| | | @Override |
| | | @Transactional(readOnly = false) |
| | | public void setAuthority(Integer roleId, String ids) { |
| | | |
| | | // 删除该角色所有的权限 |
| | | this.roleMapper.deleteRolesById(roleId); |
| | | |
| | | // 添加新的权限 |
| | | for (Long id : Convert.toLongArray(true, Convert.toStrArray(",", ids))) { |
| | | Relation relation = new Relation(); |
| | | relation.setRoleid(roleId); |
| | | relation.setMenuid(id); |
| | | this.relationMapper.insert(relation); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(readOnly = false) |
| | | public void delRoleById(Integer roleId) { |
| | | //删除角色 |
| | | this.roleMapper.deleteById(roleId); |
| | | |
| | | // 删除该角色所有的权限 |
| | | this.roleMapper.deleteRolesById(roleId); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selectRoles(String condition) { |
| | | return this.baseMapper.selectRoles(condition); |
| | | } |
| | | |
| | | @Override |
| | | public int deleteRolesById(Integer roleId) { |
| | | return this.baseMapper.deleteRolesById(roleId); |
| | | } |
| | | |
| | | @Override |
| | | public List<ZTreeNode> roleTreeList() { |
| | | return this.baseMapper.roleTreeList(); |
| | | } |
| | | |
| | | @Override |
| | | public List<ZTreeNode> roleTreeListByRoleId(String[] roleId) { |
| | | return this.baseMapper.roleTreeListByRoleId(roleId); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.SystemConfigMapper; |
| | | import com.agentdriving.user.modular.system.model.SystemConfig; |
| | | import com.agentdriving.user.modular.system.service.ISystemConfigService; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.agentdriving.user.modular.system.warpper.PriceRulesWarpper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 系统配置 |
| | | * @author pzb |
| | | * @Date 2023/2/15 16:26 |
| | | */ |
| | | @Service |
| | | public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigMapper, SystemConfig> implements ISystemConfigService { |
| | | |
| | | |
| | | /** |
| | | * 获取价格表 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public PriceRulesWarpper queryPriceRules() throws Exception { |
| | | SystemConfig systemConfig = this.selectOne(new EntityWrapper<SystemConfig>().eq("type", 5)); |
| | | PriceRulesWarpper priceRulesWarpper = new PriceRulesWarpper(); |
| | | if(null != systemConfig){ |
| | | //{"ChargeStandard":[{"num1":"06:00","num2":"08:00","num3":2,"num4":2,"num5":2,"num6":2,"num7":2,"num8":2,"num9":2,"num10":2,"num11":2},{"num1":"06:00","num2":"08:00","num3":1,"num4":1,"num5":1,"num6":1,"num7":2,"num8":2,"num9":2,"num10":2,"num11":2},{"num1":"00:00","num2":"10:00","num3":3,"num4":3,"num5":3,"num6":3,"num7":3,"num8":3,"num9":3,"num10":3,"num11":3}],"ExtraCost":{"num1":1,"num2":1,"num3":1,"num4":1,"num5":1,"num6":1,"num7":1,"num8":1,"num9":1}} |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | JSONArray chargeStandard = jsonObject.getJSONArray("ChargeStandard"); |
| | | List<Map<String, Object>> basePrice = new ArrayList<>(); |
| | | List<Map<String, Object>> longDistanceCharges = new ArrayList<>(); |
| | | for (int i = 0; i < chargeStandard.size(); i++) { |
| | | JSONObject jsonObject1 = chargeStandard.getJSONObject(i); |
| | | String num1 = jsonObject1.getString("num1"); |
| | | String num2 = jsonObject1.getString("num2"); |
| | | Double num3 = jsonObject1.getDouble("num3"); |
| | | Double num4 = jsonObject1.getDouble("num4"); |
| | | Double num5 = jsonObject1.getDouble("num5"); |
| | | Double num6 = jsonObject1.getDouble("num6"); |
| | | Double num7 = jsonObject1.getDouble("num7"); |
| | | Double num8 = jsonObject1.getDouble("num8"); |
| | | Double num9 = jsonObject1.getDouble("num9"); |
| | | Double num10 = jsonObject1.getDouble("num10"); |
| | | Double num11 = jsonObject1.getDouble("num11"); |
| | | |
| | | |
| | | Map<String, Object> map1 = new HashMap<>(); |
| | | map1.put("time", num1 + "-" + num2); |
| | | map1.put("startingMileage", num3 + "公里(包含" + num3 + "公里)"); |
| | | map1.put("startingPrice", num4 + "元"); |
| | | map1.put("exceedStartingPrice", num6 + "元/" + num5 + "公里"); |
| | | basePrice.add(map1); |
| | | |
| | | Map<String, Object> map2 = new HashMap<>(); |
| | | map2.put("time", num1 + "-" + num2); |
| | | map2.put("startingMileage", num7 + "-" + num8 + "公里"); |
| | | map2.put("startingPrice", num9 + "元"); |
| | | map2.put("exceedStartingPrice", num11 + "元/" + num10 + "公里"); |
| | | longDistanceCharges.add(map2); |
| | | } |
| | | priceRulesWarpper.setBasePrice(JSON.toJSONString(basePrice)); |
| | | priceRulesWarpper.setLongDistanceCharges(JSON.toJSONString(longDistanceCharges)); |
| | | //额外费用 |
| | | JSONObject extraCost = jsonObject.getJSONObject("ExtraCost"); |
| | | Integer num1 = extraCost.getInteger("num1"); |
| | | Double num2 = extraCost.getDouble("num2"); |
| | | Integer num3 = extraCost.getInteger("num3"); |
| | | Double num4 = extraCost.getDouble("num4"); |
| | | Double num5 = extraCost.getDouble("num5"); |
| | | Double num6 = extraCost.getDouble("num6"); |
| | | Double num7 = extraCost.getDouble("num7"); |
| | | Double num8 = extraCost.getDouble("num8"); |
| | | Double num9 = extraCost.getDouble("num9"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("waitTime", num1 + "分钟/" + num2 + "元"); |
| | | map.put("exceedWaitTime", "超出" + num3 + "分钟,收取" + num4 + "元/分钟"); |
| | | map.put("badWeather", num5 + "公里内加收" + num6 + "元,超过" + num7 + "公里按照订单单价的" + num8 + "倍计费,最高收取" + num9 + "元"); |
| | | priceRulesWarpper.setAdditionalFee(JSON.toJSONString(map)); |
| | | } |
| | | return priceRulesWarpper; |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.core.datascope.DataScope; |
| | | import com.agentdriving.user.modular.system.dao.UserMapper; |
| | | import com.agentdriving.user.modular.system.model.User; |
| | | import com.agentdriving.user.modular.system.service.IUserService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 管理员表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author stylefeng123 |
| | | * @since 2018-02-22 |
| | | */ |
| | | @Service |
| | | public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService { |
| | | |
| | | @Override |
| | | public int setStatus(Integer userId, int status) { |
| | | return this.baseMapper.setStatus(userId, status); |
| | | } |
| | | |
| | | @Override |
| | | public int changePwd(Integer userId, String pwd) { |
| | | return this.baseMapper.changePwd(userId, pwd); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selectUsers(DataScope dataScope, String name, String beginTime, String endTime, Integer deptid) { |
| | | return this.baseMapper.selectUsers(dataScope, name, beginTime, endTime, deptid); |
| | | } |
| | | |
| | | @Override |
| | | public int setRoles(Integer userId, String roleIds) { |
| | | return this.baseMapper.setRoles(userId, roleIds); |
| | | } |
| | | |
| | | @Override |
| | | public User getByAccount(String account) { |
| | | return this.baseMapper.getByAccount(account); |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.UserToCouponMapper; |
| | | import com.agentdriving.user.modular.system.model.Coupon; |
| | | import com.agentdriving.user.modular.system.model.UserToCoupon; |
| | | import com.agentdriving.user.modular.system.service.IUserToCouponService; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.agentdriving.user.modular.system.warpper.CouponWarpper; |
| | | import com.agentdriving.user.modular.system.warpper.CouponsWarpper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/2 14:22 |
| | | */ |
| | | @Service |
| | | public class UserToCouponServiceImpl extends ServiceImpl<UserToCouponMapper, UserToCoupon> implements IUserToCouponService { |
| | | |
| | | |
| | | /** |
| | | * 获取可用优惠券 |
| | | * @param uid |
| | | * @param price |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public Coupon queryCoupon(Integer uid, Double price) throws Exception { |
| | | return this.baseMapper.queryCoupon(uid, price); |
| | | } |
| | | |
| | | /** |
| | | * 获取订单支付页面的优惠券列表 |
| | | * @param uid |
| | | * @param price |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<CouponWarpper> queryPayCouponList(Integer uid, Double price) throws Exception { |
| | | return this.baseMapper.queryPayCouponList(uid, price); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户优惠券列表 |
| | | * @param uid |
| | | * @param state |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<CouponsWarpper> queryMyCoupons(Integer uid, Integer state, Integer pageNum, Integer pageSize) throws Exception { |
| | | pageNum = (pageNum - 1) * pageSize; |
| | | return this.baseMapper.queryMyCoupons(uid, state, pageNum, pageSize); |
| | | } |
| | | |
| | | @Override |
| | | public Integer queryUsedCouponNum(Integer uid) { |
| | | return this.baseMapper.queryUsedCouponNum(uid); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除优惠券 |
| | | */ |
| | | @Override |
| | | public void delUserCoupon() { |
| | | List<UserToCoupon> userToCoupons = this.selectList(new EntityWrapper<UserToCoupon>().eq("status", 1).last(" and UNIX_TIMESTAMP(expireTime) + 1296000 <= UNIX_TIMESTAMP(now())")); |
| | | for (UserToCoupon userToCoupon : userToCoupons) { |
| | | userToCoupon.setStatus(3); |
| | | this.updateById(userToCoupon); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.WeatherCityMapper; |
| | | import com.agentdriving.user.modular.system.model.WeatherCity; |
| | | import com.agentdriving.user.modular.system.service.IWeatherCityService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class WeatherCityServiceImpl extends ServiceImpl<WeatherCityMapper, WeatherCity> implements IWeatherCityService { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.modular.system.dao.YouTuiDriverMapper; |
| | | import com.agentdriving.user.modular.system.model.YouTuiDriver; |
| | | import com.agentdriving.user.modular.system.service.IYouTuiDriverService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 用户优推数据 |
| | | * @author pzb |
| | | * @Date 2023/2/22 14:06 |
| | | */ |
| | | @Service |
| | | public class YouTuiDriverServiceImpl extends ServiceImpl<YouTuiDriverMapper, YouTuiDriver> implements IYouTuiDriverService { |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.transfer; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 管理员的信息封装 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年1月11日 下午7:46:53 |
| | | */ |
| | | public class ManagerUser { |
| | | |
| | | private String userId; |
| | | |
| | | /* 用户账号 */ |
| | | private String userNo; |
| | | |
| | | /* 用户姓名 */ |
| | | private String userName; |
| | | |
| | | private String userPhone; |
| | | |
| | | //1:超级管理员 2:管理员 |
| | | private String userRole; |
| | | |
| | | /* 1:登录状态 2:退出状态 3:停用状态 */ |
| | | private Integer userStatus; |
| | | |
| | | private Date createTime; |
| | | |
| | | private Date loginTime; |
| | | |
| | | public String getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(String userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getUserNo() { |
| | | return userNo; |
| | | } |
| | | |
| | | public void setUserNo(String userNo) { |
| | | this.userNo = userNo; |
| | | } |
| | | |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | public String getUserPhone() { |
| | | return userPhone; |
| | | } |
| | | |
| | | public void setUserPhone(String userPhone) { |
| | | this.userPhone = userPhone; |
| | | } |
| | | |
| | | public String getUserRole() { |
| | | return userRole; |
| | | } |
| | | |
| | | public void setUserRole(String userRole) { |
| | | this.userRole = userRole; |
| | | } |
| | | |
| | | public Integer getUserStatus() { |
| | | return userStatus; |
| | | } |
| | | |
| | | public void setUserStatus(Integer userStatus) { |
| | | this.userStatus = userStatus; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getLoginTime() { |
| | | return loginTime; |
| | | } |
| | | |
| | | public void setLoginTime(Date loginTime) { |
| | | this.loginTime = loginTime; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.transfer; |
| | | |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | /** |
| | | * 添加管理员的请求bean |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年1月12日 下午6:46:24 |
| | | */ |
| | | public class ReqAddManager { |
| | | |
| | | // 用户姓名 |
| | | @NotNull |
| | | private String userName; |
| | | |
| | | // 用户账号 |
| | | @NotNull |
| | | private String userNo; |
| | | |
| | | // 手机号 |
| | | @NotNull |
| | | @Length(min = 11, max = 11) |
| | | private String userPhone; |
| | | |
| | | // 1:超级管理员 2:管理员 |
| | | @NotNull |
| | | private String userRole; |
| | | |
| | | // 密码 |
| | | @NotNull |
| | | private String userPassword; |
| | | |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | public String getUserNo() { |
| | | return userNo; |
| | | } |
| | | |
| | | public void setUserNo(String userNo) { |
| | | this.userNo = userNo; |
| | | } |
| | | |
| | | public String getUserPhone() { |
| | | return userPhone; |
| | | } |
| | | |
| | | public void setUserPhone(String userPhone) { |
| | | this.userPhone = userPhone; |
| | | } |
| | | |
| | | public String getUserRole() { |
| | | return userRole; |
| | | } |
| | | |
| | | public void setUserRole(String userRole) { |
| | | this.userRole = userRole; |
| | | } |
| | | |
| | | public String getUserPassword() { |
| | | return userPassword; |
| | | } |
| | | |
| | | public void setUserPassword(String userPassword) { |
| | | this.userPassword = userPassword; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.transfer; |
| | | |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | /** |
| | | * 编辑管理员的请求 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2017年1月15日 下午10:29:16 |
| | | */ |
| | | public class ReqEditManager { |
| | | |
| | | @NotNull |
| | | private String userId; |
| | | |
| | | /* 用户姓名 */ |
| | | @NotNull |
| | | private String userName; |
| | | |
| | | private String userPassword; |
| | | |
| | | @NotNull |
| | | @Length(min = 11, max = 11) |
| | | private String userPhone; |
| | | |
| | | public String getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(String userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | public String getUserPassword() { |
| | | return userPassword; |
| | | } |
| | | |
| | | public void setUserPassword(String userPassword) { |
| | | this.userPassword = userPassword; |
| | | } |
| | | |
| | | public String getUserPhone() { |
| | | return userPhone; |
| | | } |
| | | |
| | | public void setUserPhone(String userPhone) { |
| | | this.userPhone = userPhone; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.transfer; |
| | | |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 用户传输bean |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/5 22:40 |
| | | */ |
| | | public class UserDto{ |
| | | |
| | | private Integer id; |
| | | private String account; |
| | | private String password; |
| | | private String salt; |
| | | private String name; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date birthday; |
| | | private Integer sex; |
| | | private String email; |
| | | private String phone; |
| | | private String roleid; |
| | | private Integer deptid; |
| | | private Integer status; |
| | | private Date createtime; |
| | | private Integer version; |
| | | private String avatar; |
| | | |
| | | |
| | | 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 getPassword() { |
| | | return password; |
| | | } |
| | | |
| | | public void setPassword(String password) { |
| | | this.password = password; |
| | | } |
| | | |
| | | public String getSalt() { |
| | | return salt; |
| | | } |
| | | |
| | | public void setSalt(String salt) { |
| | | this.salt = salt; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Date getBirthday() { |
| | | return birthday; |
| | | } |
| | | |
| | | public void setBirthday(Date birthday) { |
| | | this.birthday = birthday; |
| | | } |
| | | |
| | | public Integer getSex() { |
| | | return sex; |
| | | } |
| | | |
| | | public void setSex(Integer sex) { |
| | | this.sex = sex; |
| | | } |
| | | |
| | | public String getEmail() { |
| | | return email; |
| | | } |
| | | |
| | | public void setEmail(String email) { |
| | | this.email = email; |
| | | } |
| | | |
| | | public String getPhone() { |
| | | return phone; |
| | | } |
| | | |
| | | public void setPhone(String phone) { |
| | | this.phone = phone; |
| | | } |
| | | |
| | | public String getRoleid() { |
| | | return roleid; |
| | | } |
| | | |
| | | public void setRoleid(String roleid) { |
| | | this.roleid = roleid; |
| | | } |
| | | |
| | | public Integer getDeptid() { |
| | | return deptid; |
| | | } |
| | | |
| | | public void setDeptid(Integer deptid) { |
| | | this.deptid = deptid; |
| | | } |
| | | |
| | | public Integer getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(Integer status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public Date getCreatetime() { |
| | | return createtime; |
| | | } |
| | | |
| | | public void setCreatetime(Date createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | public Integer getVersion() { |
| | | return version; |
| | | } |
| | | |
| | | public void setVersion(Integer version) { |
| | | this.version = version; |
| | | } |
| | | |
| | | public String getAvatar() { |
| | | return avatar; |
| | | } |
| | | |
| | | public void setAvatar(String avatar) { |
| | | this.avatar = avatar; |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.util; |
| | | |
| | | |
| | | import com.aliyuncs.CommonRequest; |
| | | import com.aliyuncs.CommonResponse; |
| | | import com.aliyuncs.DefaultAcsClient; |
| | | import com.aliyuncs.IAcsClient; |
| | | import com.aliyuncs.exceptions.ClientException; |
| | | import com.aliyuncs.profile.DefaultProfile; |
| | | import com.google.gson.Gson; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 阿里云短信工具类 |
| | | */ |
| | | @Component |
| | | public class ALiSendSms { |
| | | |
| | | // 设置鉴权参数,初始化客户端 |
| | | private DefaultProfile profile = DefaultProfile.getProfile( |
| | | "cn-hangzhou",// 地域ID |
| | | "LTAI4G9Zez9H4B36vakPXGy4",// 您的AccessKey ID |
| | | "BOVPUeZndKVbrPOq6Ef5j6oiydB3XZ");// 您的AccessKey Secret |
| | | private IAcsClient client = new DefaultAcsClient(profile); |
| | | |
| | | private static void log_print(String functionName, Object result) { |
| | | Gson gson = new Gson(); |
| | | System.out.println("-------------------------------" + functionName + "-------------------------------"); |
| | | System.out.println(gson.toJson(result)); |
| | | } |
| | | |
| | | /** |
| | | * 添加短信模板 |
| | | */ |
| | | public String addSmsTemplate() throws ClientException { |
| | | CommonRequest addSmsTemplateRequest = new CommonRequest(); |
| | | addSmsTemplateRequest.setSysDomain("dysmsapi.aliyuncs.com"); |
| | | addSmsTemplateRequest.setSysAction("AddSmsTemplate"); |
| | | addSmsTemplateRequest.setSysVersion("2017-05-25"); |
| | | // 短信类型。0:验证码;1:短信通知;2:推广短信;3:国际/港澳台消息 |
| | | addSmsTemplateRequest.putQueryParameter("TemplateType", "0"); |
| | | // 模板名称,长度为1~30个字符 |
| | | addSmsTemplateRequest.putQueryParameter("TemplateName", "测试短信模板"); |
| | | // 模板内容,长度为1~500个字符 |
| | | addSmsTemplateRequest.putQueryParameter("TemplateContent", "您正在申请手机注册,验证码为:${code},5分钟内有效!"); |
| | | // 短信模板申请说明 |
| | | addSmsTemplateRequest.putQueryParameter("Remark", "测试"); |
| | | CommonResponse addSmsTemplateResponse = client.getCommonResponse(addSmsTemplateRequest); |
| | | String data = addSmsTemplateResponse.getData(); |
| | | // 消除返回文本中的反转义字符 |
| | | String sData = data.replaceAll("'\'", ""); |
| | | log_print("addSmsTemplate", sData); |
| | | Gson gson = new Gson(); |
| | | // 将字符串转换为Map类型,取TemplateCode字段值 |
| | | Map map = gson.fromJson(sData, Map.class); |
| | | Object templateCode = map.get("TemplateCode"); |
| | | return templateCode.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 发送短信 |
| | | */ |
| | | public String sendSms(String phone, String templateCode, String json) throws ClientException { |
| | | CommonRequest request = new CommonRequest(); |
| | | request.setSysDomain("dysmsapi.aliyuncs.com"); |
| | | request.setSysVersion("2017-05-25"); |
| | | request.setSysAction("SendSms"); |
| | | // 接收短信的手机号码 |
| | | request.putQueryParameter("PhoneNumbers", phone); |
| | | // 短信签名名称。请在控制台签名管理页面签名名称一列查看(必须是已添加、并通过审核的短信签名)。 |
| | | request.putQueryParameter("SignName", "OK出行"); |
| | | // 短信模板ID |
| | | request.putQueryParameter("TemplateCode", templateCode); |
| | | // 短信模板变量对应的实际值,JSON格式。 |
| | | request.putQueryParameter("TemplateParam", json); |
| | | CommonResponse commonResponse = client.getCommonResponse(request); |
| | | String data = commonResponse.getData(); |
| | | String sData = data.replaceAll("'\'", ""); |
| | | log_print("sendSms", sData); |
| | | return sData; |
| | | } |
| | | |
| | | /** |
| | | * 查询发送详情 |
| | | */ |
| | | private void querySendDetails(String bizId) throws ClientException { |
| | | CommonRequest request = new CommonRequest(); |
| | | request.setSysDomain("dysmsapi.aliyuncs.com"); |
| | | request.setSysVersion("2017-05-25"); |
| | | request.setSysAction("QuerySendDetails"); |
| | | // 接收短信的手机号码 |
| | | request.putQueryParameter("PhoneNumber", "156xxxxxxxx"); |
| | | // 短信发送日期,支持查询最近30天的记录。格式为yyyyMMdd,例如20191010。 |
| | | request.putQueryParameter("SendDate", "20191010"); |
| | | // 分页记录数量 |
| | | request.putQueryParameter("PageSize", "10"); |
| | | // 分页当前页码 |
| | | request.putQueryParameter("CurrentPage", "1"); |
| | | // 发送回执ID,即发送流水号。 |
| | | request.putQueryParameter("BizId", bizId); |
| | | CommonResponse response = client.getCommonResponse(request); |
| | | log_print("querySendDetails", response.getData()); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | ALiSendSms sendSmsDemo = new ALiSendSms(); |
| | | try { |
| | | // 创建短信模板 |
| | | String templateCode = sendSmsDemo.addSmsTemplate(); |
| | | // 使用刚创建的短信模板发送短信 |
| | | String sData = sendSmsDemo.sendSms("156xxxxxxxx", templateCode, "{\"code\":\"8888\"}"); |
| | | Gson gson = new Gson(); |
| | | Map map = gson.fromJson(sData, Map.class); |
| | | String bizId = map.get("BizId").toString(); |
| | | // 根据短信发送流水号查询短信发送情况 |
| | | sendSmsDemo.querySendDetails(bizId); |
| | | } catch (ClientException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.util; |
| | | |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 日期处理工具类 |
| | | */ |
| | | @Component |
| | | public class DateUtil { |
| | | |
| | | |
| | | /** |
| | | * 获取给定日期天的开始时间点或结束时间点 |
| | | * @param time 日期 |
| | | * @param type 时间点类型start一天的开始时间点,end一天的结束时间点 |
| | | * @return |
| | | */ |
| | | public Date getStartOrEndDate(Date time, String type){ |
| | | if(ToolUtil.isEmpty(time) || ToolUtil.isEmpty(type)){ |
| | | return null; |
| | | } |
| | | int hourOfDay = "start".equals(type) ? 0 : 23; |
| | | int minute = "start".equals(type) ? 0 : 59; |
| | | int second = "start".equals(type) ? 0 : 59; |
| | | int millisecond = "start".equals(type) ? 0 : 999; |
| | | Calendar s = Calendar.getInstance(); |
| | | s.setTime(time); |
| | | s.set(s.get(Calendar.YEAR), s.get(Calendar.MONTH), s.get(Calendar.DAY_OF_MONTH), hourOfDay, minute, second); |
| | | s.set(Calendar.MILLISECOND, millisecond); |
| | | return s.getTime(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取给定日期天的起始时间和结束时间 |
| | | * @param time |
| | | * @return |
| | | */ |
| | | public Map<String, Date> getStartAndEndDate(Date time){ |
| | | if(ToolUtil.isEmpty(time)){ |
| | | return null; |
| | | } |
| | | Map<String, Date> map = new HashMap<>(); |
| | | map.put("startTime", getStartOrEndDate(time, "start")); |
| | | map.put("endTime", getStartOrEndDate(time, "end")); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取格式化的字符串日期返回日期天的起始时间和结束时间 |
| | | * @param time yyyy-MM-dd DD:mm:ss/yyyy-MM-dd |
| | | * @return |
| | | */ |
| | | public Map<String, Date> getStartAndEndDate(String time){ |
| | | if(ToolUtil.isEmpty(time)){ |
| | | return null; |
| | | } |
| | | int index = time.indexOf(" "); |
| | | String pattern = "yyyy-MM-dd DD:mm:ss"; |
| | | if(index == -1){ |
| | | pattern = "yyyy-MM-dd"; |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat(pattern); |
| | | Date date = null; |
| | | try { |
| | | date = sdf.parse(time); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return getStartAndEndDate(date); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取格式化的字符串区间日期返回区间日期天的起始时间和结束时间 |
| | | * @param time yyyy-MM-dd DD:mm:ss - yyyy-MM-dd DD:mm:ss/yyyy-MM-dd - yyyy-MM-dd |
| | | * @param split 区间时间的分隔符 |
| | | * @return |
| | | */ |
| | | public List<Date> getStartAndEndDate(String time, String split){ |
| | | if(ToolUtil.isEmpty(time) || ToolUtil.isEmpty(split)){ |
| | | return null; |
| | | } |
| | | List<Date> list = new ArrayList<>(); |
| | | String[] split1 = time.split(split); |
| | | int index = split1[0].indexOf(" "); |
| | | String pattern = "yyyy-MM-dd DD:mm:ss"; |
| | | if(index == -1){ |
| | | pattern = "yyyy-MM-dd"; |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat(pattern); |
| | | Date date1 = null; |
| | | Date date2 = null; |
| | | try { |
| | | date1 = sdf.parse(split1[0]); |
| | | date2 = sdf.parse(split1[1]); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | list.add(getStartOrEndDate(date1, "start")); |
| | | list.add(getStartOrEndDate(date2, "end")); |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取月初和月末日期 |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public Map<String, Date> getMonthStartAndEnd(Date date){ |
| | | Calendar s = Calendar.getInstance(); |
| | | s.setTime(date); |
| | | s.set(Calendar.DAY_OF_MONTH, 1); |
| | | Calendar e = Calendar.getInstance(); |
| | | e.setTime(date); |
| | | e.set(Calendar.DAY_OF_MONTH, e.getActualMaximum(Calendar.DAY_OF_MONTH)); |
| | | Date start = this.getStartOrEndDate(s.getTime(), "start"); |
| | | Date end = this.getStartOrEndDate(e.getTime(), "end"); |
| | | Map<String, Date> map = new HashMap<>(); |
| | | map.put("startTime", start); |
| | | map.put("endTime", end); |
| | | return map; |
| | | } |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.util.GaoDe; |
| | | |
| | | /** |
| | | * 高德地图配置 |
| | | * @author pzb |
| | | * @Date 2023/2/16 18:52 |
| | | */ |
| | | public interface MapConfig { |
| | | |
| | | /** |
| | | * 高德key |
| | | */ |
| | | String key = "e0370a9a4d10739045fb0b8f4742a67e"; |
| | | } |
New file |
| | |
| | | package com.agentdriving.user.modular.system.util.GaoDe; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.agentdriving.user.modular.system.util.GaoDe.model.District; |
| | | import com.agentdriving.user.modular.system.util.httpClinet.HttpClientUtil; |
| | | import com.agentdriving.user.modular.system.util.httpClinet.HttpResult; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * 地图工具类 |
| | | * @author pzb |
| | | * @Date 2023/2/16 18:48 |
| | | */ |
| | | public class MapUtil { |
| | | |
| | | public static Logger logger = LoggerFactory.getLogger("ServiceLog"); |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取两点的距离 |
| | | * @param origins 起点坐标 |
| | | * @param destination 终点坐标 |
| | | * @param type 计算类型:0:直线距离 1:驾车导航距离(仅支持国内坐标)。 |
| | | * @return |
| | | */ |
| | | public static Map<String, String> getDistance(String origins, String destination, Integer type){ |
| | | try { |
| | | String url = "https://restapi.amap.com/v3/distance?key=" + MapConfig.key + "&origins=" + origins + "&destination=" + destination + |
| | | "&type=" + type; |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "json"); |
| | | if(httpResult.getCode() != 200){ |
| | | logger.debug(httpResult.getData()); |
| | | return null; |
| | | } |
| | | String data = httpResult.getData(); |
| | | JSONObject jsonObject = JSON.parseObject(data); |
| | | String status = jsonObject.getString("status"); |
| | | if(status.equals("1")){ |
| | | JSONArray results = jsonObject.getJSONArray("results"); |
| | | JSONObject jsonObject1 = results.getJSONObject(0); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("distance", jsonObject1.getString("distance"));//距离(米) |
| | | map.put("duration", jsonObject1.getString("duration"));//预计时间(秒) |
| | | return map; |
| | | }else{ |
| | | logger.debug(data); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 地址转换经纬度 |
| | | * @param address |
| | | * @return |
| | | */ |
| | | public static List<String> geocoding(String address){ |
| | | try { |
| | | String url = "https://restapi.amap.com/v3/geocode/geo?key=" + MapConfig.key + "&output=JSON&address=" + address; |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "json"); |
| | | if(httpResult.getCode() != 200){ |
| | | return null; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(httpResult.getData()); |
| | | String status = jsonObject.getString("status"); |
| | | List<String> list = new ArrayList<>(); |
| | | if(status.equals("1")){ |
| | | JSONArray geocodes = jsonObject.getJSONArray("geocodes"); |
| | | for(int i = 0; i < geocodes.size(); i++){ |
| | | String location = geocodes.getJSONObject(i).getString("location"); |
| | | list.add(location); |
| | | } |
| | | } |
| | | return list; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据经纬度获取行政区域信息 |
| | | * @param lon |
| | | * @param lan |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static District geocode(String lon, String lan) { |
| | | try { |
| | | String url = "https://restapi.amap.com/v3/geocode/regeo?key=" + MapConfig.key + "&location=" + lon + "," + lan; |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "json"); |
| | | if(httpResult.getCode() != 200){ |
| | | return null; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(httpResult.getData()); |
| | | Map<String, String> map = new HashMap<>(); |
| | | if(jsonObject.getString("status").equals("1")){ |
| | | JSONObject regeocode = jsonObject.getJSONObject("regeocode"); |
| | | JSONObject addressComponent = regeocode.getJSONObject("addressComponent"); |
| | | String address = regeocode.getString("formatted_address"); |
| | | map.put("address", address); |
| | | String code = addressComponent.getString("adcode"); |
| | | String province = addressComponent.getString("province"); |
| | | String city = addressComponent.getString("city"); |
| | | String district = addressComponent.getString("district"); |
| | | District district1 = new District(); |
| | | district1.setProvince(province); |
| | | district1.setProvinceCode(code.substring(0, 2) + "0000"); |
| | | district1.setCity(city); |
| | | district1.setCityCode(code.substring(0, 4) + "00"); |
| | | district1.setDistrict(district); |
| | | district1.setDistrictCode(code); |
| | | return district1; |
| | | } |
| | | logger.debug(httpResult.getData()); |
| | | return null; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | } |
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/GaoDe/model/District.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/GeodesyUtil.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/JGPushUtil.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MD5AndKL.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/config/ChannelConfig.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/Complete.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/InterfaceRequest.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/InterfaceResponse.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/PamentOrderUser.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/PaymentOrder.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/PaymentOrderGood.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/Receive.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/ReceiveGood.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/model/ReceiveUser.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/Base64.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/CacheUtils.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/RSAEncryptGeneration.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/RSASignature.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/StringUtil.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/Transfer.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/MallBook/util/TrhRequest.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/PayMoneyUtil.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/PushUtil.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/RedisUtil.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/ResultUtil.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/SystemException.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/TaskUtil.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/UUIDUtil.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/httpClinet/HttpClientUtil.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/httpClinet/HttpResult.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/huawei/OBSUtil.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/huawei/SMSUtil.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/juhe/Realtime.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/juhe/WeatherCityInfo.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/juhe/WeatherUtil.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/mongodb/MongoUtils.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/mongodb/model/GeoJson.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/mongodb/model/Location.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/mongodb/model/LocationQuery.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/AES.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/AesException.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/ByteGroup.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/PKCS7Encoder.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/SHA1.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/WXBizMsgCrypt.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/WXCore.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/WeChatUtil.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/WxPKCS7Encoder.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/XMLParse.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/Category.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/Code2Session.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/KeywordEnum.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/MessageTemplate.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/PubTemplateKeywords.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/util/weChat/model/PubTemplatetitles.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/ActivityWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/BalanceDetailsWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/BaseWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/BillWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/CommercialWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/CouponWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/CouponsWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/DeptWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/DictWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/DriverInfoWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/EditOrderEndAddress.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/EstimatedCosts.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/EstimatedCostsWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/HomeWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/Invoicing.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/LogWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/LoginWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/MenuWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/MoneyInfoWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/NearbyDriverWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/NotInvoiceOrder.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/NoticeWrapper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderEvaluateWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderInfoWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderListWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderPayment.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/OrderPriceWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/PriceRulesWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/PushOrderInfoWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/RegisteredWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/ResponseWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/RoleWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/SignInToRegister.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/SignInToRegisterWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/StartPriceWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/SystemNoticeWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/TravelOrder.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/UserInfo.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/UserInfoWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/UserWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/VersionWarpper.java
user/guns-admin/src/main/java/com/agentdriving/user/modular/system/warpper/WithdrawalWarpper.java
user/guns-admin/src/main/resources/META-INF/spring-devtools.properties
user/guns-admin/src/main/resources/application.yml
user/guns-admin/src/main/resources/ehcache.xml
user/guns-admin/src/main/resources/logback-spring.xml
user/guns-admin/src/main/resources/redis.properties
user/guns-admin/src/main/webapp/WEB-INF/view/404.html
user/guns-admin/src/main/webapp/WEB-INF/view/blackboard.html
user/guns-admin/src/main/webapp/WEB-INF/view/code/code.html
user/guns-admin/src/main/webapp/WEB-INF/view/common/_container.html
user/guns-admin/src/main/webapp/WEB-INF/view/common/_right.html
user/guns-admin/src/main/webapp/WEB-INF/view/common/_tab.html
user/guns-admin/src/main/webapp/WEB-INF/view/common/_theme.html
user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/NameCon.tag
user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/SelectCon.tag
user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/TimeCon.tag
user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/avatar.tag
user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/button.tag
user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/input.tag
user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/select.tag
user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/table.tag
user/guns-admin/src/main/webapp/WEB-INF/view/common/tags/tag_tips
user/guns-admin/src/main/webapp/WEB-INF/view/index.html
user/guns-admin/src/main/webapp/WEB-INF/view/login.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/code/code.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/dept/dept.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/dept/dept_add.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/dept/dept_edit.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/dict/dict.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/dict/dict_add.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/dict/dict_edit.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/log/log.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/log/login_log.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/menu/menu.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/menu/menu_add.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/menu/menu_edit.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/notice/notice.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/notice/notice_add.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/notice/notice_edit.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/role/role.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/role/role_add.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/role/role_assign.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/role/role_edit.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_add.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_chpwd.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_edit.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_roleassign.html
user/guns-admin/src/main/webapp/WEB-INF/view/system/user/user_view.html
user/guns-admin/src/main/webapp/static/css/_fstyle.css
user/guns-admin/src/main/webapp/static/css/bootstrap-rtl.css
user/guns-admin/src/main/webapp/static/css/bootstrap.min.css
user/guns-admin/src/main/webapp/static/css/font-awesome.css
user/guns-admin/src/main/webapp/static/css/font-awesome.min.css
user/guns-admin/src/main/webapp/static/css/login.css
user/guns-admin/src/main/webapp/static/css/patterns/header-profile-skin-1.png
user/guns-admin/src/main/webapp/static/css/patterns/header-profile-skin-3.png
user/guns-admin/src/main/webapp/static/css/patterns/header-profile.png
user/guns-admin/src/main/webapp/static/css/patterns/shattered.png
user/guns-admin/src/main/webapp/static/css/plugins/bootstrap-table/bootstrap-table.min.css
user/guns-admin/src/main/webapp/static/css/plugins/bootstrap-treetable/bootstrap-treetable.css
user/guns-admin/src/main/webapp/static/css/plugins/chosen/chosen-sprite.png
user/guns-admin/src/main/webapp/static/css/plugins/chosen/chosen-sprite@2x.png
user/guns-admin/src/main/webapp/static/css/plugins/chosen/chosen.css
user/guns-admin/src/main/webapp/static/css/plugins/iCheck/custom.css
user/guns-admin/src/main/webapp/static/css/plugins/iCheck/green.png
user/guns-admin/src/main/webapp/static/css/plugins/iCheck/green@2x.png
user/guns-admin/src/main/webapp/static/css/plugins/images/sprite-skin-flat.png
user/guns-admin/src/main/webapp/static/css/plugins/validate/bootstrapValidator.min.css
user/guns-admin/src/main/webapp/static/css/plugins/webuploader/webuploader.css
user/guns-admin/src/main/webapp/static/css/plugins/ztree/demo.css
user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/1_close.png
user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/1_open.png
user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/2.png
user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/3.png
user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/4.png
user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/5.png
user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/6.png
user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/7.png
user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/8.png
user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/diy/9.png
user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/line_conn.gif
user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/loading.gif
user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/zTreeStandard.gif
user/guns-admin/src/main/webapp/static/css/plugins/ztree/img/zTreeStandard.png
user/guns-admin/src/main/webapp/static/css/plugins/ztree/zTreeStyle.css
user/guns-admin/src/main/webapp/static/css/style.css
user/guns-admin/src/main/webapp/static/favicon.ico
user/guns-admin/src/main/webapp/static/fonts/FontAwesome.otf
user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.eot
user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.svg
user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.ttf
user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.woff
user/guns-admin/src/main/webapp/static/fonts/fontawesome-webfont.woff2
user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.eot
user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.svg
user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.ttf
user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.woff
user/guns-admin/src/main/webapp/static/fonts/glyphicons-halflings-regular.woff2
user/guns-admin/src/main/webapp/static/img/bg.png
user/guns-admin/src/main/webapp/static/img/boy.gif
user/guns-admin/src/main/webapp/static/img/girl.gif
user/guns-admin/src/main/webapp/static/img/icons.png
user/guns-admin/src/main/webapp/static/img/loading-upload.gif
user/guns-admin/src/main/webapp/static/img/locked.png
user/guns-admin/src/main/webapp/static/img/user.png
user/guns-admin/src/main/webapp/static/js/bootstrap.min.js
user/guns-admin/src/main/webapp/static/js/common/DateUtils.js
user/guns-admin/src/main/webapp/static/js/common/Feng.js
user/guns-admin/src/main/webapp/static/js/common/ajax-object.js
user/guns-admin/src/main/webapp/static/js/common/bootstrap-table-object.js
user/guns-admin/src/main/webapp/static/js/common/select-list-object.js
user/guns-admin/src/main/webapp/static/js/common/tree-table-object.js
user/guns-admin/src/main/webapp/static/js/common/web-upload-object.js
user/guns-admin/src/main/webapp/static/js/common/ztree-object.js
user/guns-admin/src/main/webapp/static/js/contabs.js
user/guns-admin/src/main/webapp/static/js/content.js
user/guns-admin/src/main/webapp/static/js/hplus.js
user/guns-admin/src/main/webapp/static/js/jquery.min.js
user/guns-admin/src/main/webapp/static/js/jquery.min.map
user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js
user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-table/bootstrap-table.min.js
user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.js
user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js
user/guns-admin/src/main/webapp/static/js/plugins/bootstrap-treetable/bootstrap-treetable.js
user/guns-admin/src/main/webapp/static/js/plugins/chosen/chosen.jquery.js
user/guns-admin/src/main/webapp/static/js/plugins/iCheck/icheck.min.js
user/guns-admin/src/main/webapp/static/js/plugins/laydate/laydate.js
user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/font/iconfont.eot
user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/font/iconfont.svg
user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/font/iconfont.ttf
user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/font/iconfont.woff
user/guns-admin/src/main/webapp/static/js/plugins/laydate/theme/default/laydate.css
user/guns-admin/src/main/webapp/static/js/plugins/layer/layer.js
user/guns-admin/src/main/webapp/static/js/plugins/layer/mobile/layer.js
user/guns-admin/src/main/webapp/static/js/plugins/layer/mobile/need/layer.css
user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/icon-ext.png
user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/icon.png
user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/layer.css
user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/loading-0.gif
user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/loading-1.gif
user/guns-admin/src/main/webapp/static/js/plugins/layer/theme/default/loading-2.gif
user/guns-admin/src/main/webapp/static/js/plugins/metisMenu/jquery.metisMenu.js
user/guns-admin/src/main/webapp/static/js/plugins/pace/pace.min.js
user/guns-admin/src/main/webapp/static/js/plugins/slimscroll/jquery.slimscroll.min.js
user/guns-admin/src/main/webapp/static/js/plugins/validate/additional-methods.min.js
user/guns-admin/src/main/webapp/static/js/plugins/validate/bootstrapValidator.min.js
user/guns-admin/src/main/webapp/static/js/plugins/validate/zh_CN.js
user/guns-admin/src/main/webapp/static/js/plugins/wangEditor/wangEditor.js
user/guns-admin/src/main/webapp/static/js/plugins/webuploader/Uploader.swf
user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.css
user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.custom.js
user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.custom.min.js
user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.fis.js
user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.flashonly.js
user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.flashonly.min.js
user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.html5only.js
user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.html5only.min.js
user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.js
user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.min.js
user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.noimage.js
user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.noimage.min.js
user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.nolog.js
user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.nolog.min.js
user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.withoutimage.js
user/guns-admin/src/main/webapp/static/js/plugins/webuploader/webuploader.withoutimage.min.js
user/guns-admin/src/main/webapp/static/js/plugins/ztree/jquery.ztree.all.min.js
user/guns-admin/src/main/webapp/static/modular/code/gen.js
user/guns-admin/src/main/webapp/static/modular/flowable/expense/expense.js
user/guns-admin/src/main/webapp/static/modular/flowable/expense/expense_info.js
user/guns-admin/src/main/webapp/static/modular/flowable/process/process.js
user/guns-admin/src/main/webapp/static/modular/flowable/process/process_info.js
user/guns-admin/src/main/webapp/static/modular/system/code/code.js
user/guns-admin/src/main/webapp/static/modular/system/dept/dept.js
user/guns-admin/src/main/webapp/static/modular/system/dept/dept_info.js
user/guns-admin/src/main/webapp/static/modular/system/dict/dict.js
user/guns-admin/src/main/webapp/static/modular/system/dict/dict_info.js
user/guns-admin/src/main/webapp/static/modular/system/log/log.js
user/guns-admin/src/main/webapp/static/modular/system/log/login_log.js
user/guns-admin/src/main/webapp/static/modular/system/menu/menu.js
user/guns-admin/src/main/webapp/static/modular/system/menu/menu_info.js
user/guns-admin/src/main/webapp/static/modular/system/notice/notice.js
user/guns-admin/src/main/webapp/static/modular/system/notice/notice_info.js
user/guns-admin/src/main/webapp/static/modular/system/role/role.js
user/guns-admin/src/main/webapp/static/modular/system/role/role_info.js
user/guns-admin/src/main/webapp/static/modular/system/user/user.js
user/guns-admin/src/main/webapp/static/modular/system/user/user_info.js
user/guns-admin/src/test/sql/test.sql
user/guns-core/pom.xml
user/guns-core/src/main/java/com/agentdriving/user/core/CoreFlag.java
user/guns-core/src/main/java/com/agentdriving/user/core/aop/BaseControllerExceptionHandler.java
user/guns-core/src/main/java/com/agentdriving/user/core/base/controller/BaseController.java
user/guns-core/src/main/java/com/agentdriving/user/core/base/controller/GlobalController.java
user/guns-core/src/main/java/com/agentdriving/user/core/base/controller/GunsErrorView.java
user/guns-core/src/main/java/com/agentdriving/user/core/base/tips/ErrorTip.java
user/guns-core/src/main/java/com/agentdriving/user/core/base/tips/SuccessTip.java
user/guns-core/src/main/java/com/agentdriving/user/core/base/tips/Tip.java
user/guns-core/src/main/java/com/agentdriving/user/core/base/warpper/BaseControllerWarpper.java
user/guns-core/src/main/java/com/agentdriving/user/core/cache/BaseCacheFactory.java
user/guns-core/src/main/java/com/agentdriving/user/core/cache/CacheKit.java
user/guns-core/src/main/java/com/agentdriving/user/core/cache/EhcacheFactory.java
user/guns-core/src/main/java/com/agentdriving/user/core/cache/ICache.java
user/guns-core/src/main/java/com/agentdriving/user/core/cache/ILoader.java
user/guns-core/src/main/java/com/agentdriving/user/core/config/DefaultFastjsonConfig.java
user/guns-core/src/main/java/com/agentdriving/user/core/config/DefaultMultiConfig.java
user/guns-core/src/main/java/com/agentdriving/user/core/config/DefaultProperties.java
user/guns-core/src/main/java/com/agentdriving/user/core/config/DefaultWebConfig.java
user/guns-core/src/main/java/com/agentdriving/user/core/config/properties/DruidProperties.java
user/guns-core/src/main/java/com/agentdriving/user/core/config/properties/MutiDataSourceProperties.java
user/guns-core/src/main/java/com/agentdriving/user/core/constant/IsMenu.java
user/guns-core/src/main/java/com/agentdriving/user/core/datascope/DataScope.java
user/guns-core/src/main/java/com/agentdriving/user/core/datascope/DataScopeInterceptor.java
user/guns-core/src/main/java/com/agentdriving/user/core/db/Db.java
user/guns-core/src/main/java/com/agentdriving/user/core/exception/GunsException.java
user/guns-core/src/main/java/com/agentdriving/user/core/exception/GunsExceptionEnum.java
user/guns-core/src/main/java/com/agentdriving/user/core/exception/ServiceExceptionEnum.java
user/guns-core/src/main/java/com/agentdriving/user/core/mutidatasource/DataSourceContextHolder.java
user/guns-core/src/main/java/com/agentdriving/user/core/mutidatasource/DynamicDataSource.java
user/guns-core/src/main/java/com/agentdriving/user/core/mutidatasource/annotion/DataSource.java
user/guns-core/src/main/java/com/agentdriving/user/core/mutidatasource/aop/MultiSourceExAop.java
user/guns-core/src/main/java/com/agentdriving/user/core/node/MenuNode.java
user/guns-core/src/main/java/com/agentdriving/user/core/node/ZTreeNode.java
user/guns-core/src/main/java/com/agentdriving/user/core/page/PageBT.java
user/guns-core/src/main/java/com/agentdriving/user/core/page/PageInfoBT.java
user/guns-core/src/main/java/com/agentdriving/user/core/qr/ImgQrTool.java
user/guns-core/src/main/java/com/agentdriving/user/core/qr/MatrixToImageConfig.java
user/guns-core/src/main/java/com/agentdriving/user/core/qr/MatrixToImageWriter.java
user/guns-core/src/main/java/com/agentdriving/user/core/qr/QrImage.java
user/guns-core/src/main/java/com/agentdriving/user/core/support/BasicType.java
user/guns-core/src/main/java/com/agentdriving/user/core/support/BeanKit.java
user/guns-core/src/main/java/com/agentdriving/user/core/support/ClassKit.java
user/guns-core/src/main/java/com/agentdriving/user/core/support/CollectionKit.java
user/guns-core/src/main/java/com/agentdriving/user/core/support/DateTime.java
user/guns-core/src/main/java/com/agentdriving/user/core/support/DateTimeKit.java
user/guns-core/src/main/java/com/agentdriving/user/core/support/HexKit.java
user/guns-core/src/main/java/com/agentdriving/user/core/support/HttpKit.java
user/guns-core/src/main/java/com/agentdriving/user/core/support/ObjectKit.java
user/guns-core/src/main/java/com/agentdriving/user/core/support/PageKit.java
user/guns-core/src/main/java/com/agentdriving/user/core/support/StrKit.java
user/guns-core/src/main/java/com/agentdriving/user/core/support/WafKit.java
user/guns-core/src/main/java/com/agentdriving/user/core/support/WafRequestWrapper.java
user/guns-core/src/main/java/com/agentdriving/user/core/support/exception/ToolBoxException.java
user/guns-core/src/main/java/com/agentdriving/user/core/util/Convert.java
user/guns-core/src/main/java/com/agentdriving/user/core/util/DateUtil.java
user/guns-core/src/main/java/com/agentdriving/user/core/util/FileUtil.java
user/guns-core/src/main/java/com/agentdriving/user/core/util/HttpSessionHolder.java
user/guns-core/src/main/java/com/agentdriving/user/core/util/IdGenerator.java
user/guns-core/src/main/java/com/agentdriving/user/core/util/MD5Util.java
user/guns-core/src/main/java/com/agentdriving/user/core/util/NumUtil.java
user/guns-core/src/main/java/com/agentdriving/user/core/util/PingYinUtil.java
user/guns-core/src/main/java/com/agentdriving/user/core/util/RenderUtil.java
user/guns-core/src/main/java/com/agentdriving/user/core/util/ResKit.java
user/guns-core/src/main/java/com/agentdriving/user/core/util/SimpleContrast.java
user/guns-core/src/main/java/com/agentdriving/user/core/util/SpringContextHolder.java
user/guns-core/src/main/java/com/agentdriving/user/core/util/SqlUtil.java
user/guns-core/src/main/java/com/agentdriving/user/core/util/ToolUtil.java
user/guns-core/src/main/java/com/agentdriving/user/core/xss/XssFilter.java
user/guns-core/src/main/java/com/agentdriving/user/core/xss/XssHttpServletRequestWrapper.java
user/guns-core/src/main/resources/META-INF/spring.factories
user/guns-core/src/main/resources/default-config.properties
user/guns-generator/pom.xml
user/guns-generator/src/main/java/com/agentdriving/user/generator/action/GunsCodeGenerator.java
user/guns-generator/src/main/java/com/agentdriving/user/generator/action/config/AbstractGeneratorConfig.java
user/guns-generator/src/main/java/com/agentdriving/user/generator/action/config/GunsGeneratorConfig.java
user/guns-generator/src/main/java/com/agentdriving/user/generator/action/config/WebGeneratorConfig.java
user/guns-generator/src/main/java/com/agentdriving/user/generator/action/model/GenQo.java
user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/SimpleTemplateEngine.java
user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/base/AbstractTemplateEngine.java
user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/base/GunsTemplateEngine.java
user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/ContextConfig.java
user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/ControllerConfig.java
user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/DaoConfig.java
user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/Menu.java
user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/PageConfig.java
user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/ServiceConfig.java
user/guns-generator/src/main/java/com/agentdriving/user/generator/engine/config/SqlConfig.java
user/guns-generator/src/main/resources/gunsTemplate/advanced/Controller.java.btl
user/guns-generator/src/main/resources/gunsTemplate/advanced/menu_sql.sql.btl
user/guns-generator/src/main/resources/gunsTemplate/advanced/page.html.btl
user/guns-generator/src/main/resources/gunsTemplate/advanced/page.js.btl
user/guns-generator/src/main/resources/gunsTemplate/advanced/page_add.html.btl
user/guns-generator/src/main/resources/gunsTemplate/advanced/page_edit.html.btl
user/guns-generator/src/main/resources/gunsTemplate/advanced/page_info.js.btl
user/pom.xml |