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>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-tomcat</artifactId> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>javax.servlet</groupId> |
| | | <artifactId>javax.servlet-api</artifactId> |
| | | <version>3.1.0</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | |
| | | <!--shiro依赖--> |
| | | <dependency> |
| | | <groupId>org.apache.shiro</groupId> |
| | | <artifactId>shiro-core</artifactId> |
| | | <exclusions> |
| | | <exclusion> |
| | | <artifactId>slf4j-api</artifactId> |
| | | <groupId>org.slf4j</groupId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.shiro</groupId> |
| | | <artifactId>shiro-spring</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.shiro</groupId> |
| | | <artifactId>shiro-ehcache</artifactId> |
| | | <exclusions> |
| | | <exclusion> |
| | | <artifactId>slf4j-api</artifactId> |
| | | <groupId>org.slf4j</groupId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.ehcache</groupId> |
| | | <artifactId>ehcache</artifactId> |
| | | </dependency> |
| | | |
| | | <!--需要分布式session的话需要放开注释--> |
| | | <!--<dependency>--> |
| | | <!--<groupId>org.springframework.session</groupId>--> |
| | | <!--<artifactId>spring-session-data-redis</artifactId>--> |
| | | <!--</dependency>--> |
| | | <!--<dependency>--> |
| | | <!--<groupId>org.springframework.boot</groupId>--> |
| | | <!--<artifactId>spring-boot-starter-data-redis</artifactId>--> |
| | | <!--</dependency>--> |
| | | |
| | | <dependency> |
| | | <groupId>com.github.penggle</groupId> |
| | | <artifactId>kaptcha</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>core</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ibeetl</groupId> |
| | | <artifactId>beetl</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger2</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger-ui</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>io.jsonwebtoken</groupId> |
| | | <artifactId>jjwt</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>redis.clients</groupId> |
| | | <artifactId>jedis</artifactId> |
| | | <version>2.9.0</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>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> |
| | | <!-- oos对象存储 --> |
| | | <dependency> |
| | | <groupId>com.aliyun.oss</groupId> |
| | | <artifactId>aliyun-sdk-oss</artifactId> |
| | | <version>3.8.0</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> |
| | | |
| | | <!--引入本地工行支付jar start--> |
| | | <dependency> |
| | | <groupId>com.icbc</groupId> |
| | | <artifactId>icbc</artifactId> |
| | | <version>v2</version> |
| | | <scope>system</scope> |
| | | <systemPath>${project.basedir}/lib/icbc-api-sdk-cop.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.icbc.api</groupId> |
| | | <artifactId>icbc</artifactId> |
| | | <version>v2</version> |
| | | <scope>system</scope> |
| | | <systemPath>${project.basedir}/lib/icbc-api-sdk-cop-io.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.com.infosec</groupId> |
| | | <artifactId>icbc</artifactId> |
| | | <version>v2</version> |
| | | <scope>system</scope> |
| | | <systemPath>${project.basedir}/lib/icbc-ca.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.com.infosecCrypto</groupId> |
| | | <artifactId>icbc</artifactId> |
| | | <version>v2</version> |
| | | <scope>system</scope> |
| | | <systemPath>${project.basedir}/lib/InfosecCrypto_Java1_02_JDK14+.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>proguard</groupId> |
| | | <artifactId>icbc</artifactId> |
| | | <version>v2</version> |
| | | <scope>system</scope> |
| | | <systemPath>${project.basedir}/lib/proguard.jar</systemPath> |
| | | </dependency> |
| | | <!--引入本地工行支付jar end--> |
| | | |
| | | <dependency> |
| | | <groupId>commons-codec</groupId> |
| | | <artifactId>commons-codec</artifactId> |
| | | <version>1.13</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.supersavedriving.user; |
| | | |
| | | import com.supersavedriving.user.modular.system.util.GDFalconUtil; |
| | | import org.apache.http.client.HttpClient; |
| | | import org.apache.http.config.SocketConfig; |
| | | import org.apache.http.impl.client.HttpClientBuilder; |
| | | import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cloud.client.loadbalancer.LoadBalanced; |
| | | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; |
| | | import org.springframework.http.converter.StringHttpMessageConverter; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.nio.charset.StandardCharsets; |
| | | |
| | | /** |
| | | * SpringBoot方式启动类 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/21 12:06 |
| | | */ |
| | | @EnableEurekaClient//注册为服务提供者 |
| | | @SpringBootApplication |
| | | @EnableScheduling//开启定时任务 |
| | | @EnableTransactionManagement//启动事务功能 |
| | | public class GunsApplication { |
| | | |
| | | 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!"); |
| | | |
| | | GDFalconUtil gdFalconUtil = new GDFalconUtil(); |
| | | gdFalconUtil.init();//初始化猎鹰服务 |
| | | } |
| | | |
| | | |
| | | @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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.user.modular.system.controller")) //这里采用包扫描的方式来确定要显示的接口 |
| | | .paths(PathSelectors.any()) |
| | | .build(); |
| | | } |
| | | |
| | | private ApiInfo apiInfo() { |
| | | return new ApiInfoBuilder() |
| | | .title("OK出行 Doc") |
| | | .description("所有接口前需要加 /driver 前缀,例如:/driver/base/agreement/queryByType <br>所有以 /api/*** 路径的接口需要上传签名参数sign") |
| | | // .termsOfServiceUrl("http://git.oschina.net/naan1993/guns") |
| | | .contact("stylefeng") |
| | | .version("1.0") |
| | | .build(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.config.datasource; |
| | | |
| | | import com.alibaba.druid.pool.DruidDataSource; |
| | | import com.baomidou.mybatisplus.plugins.OptimisticLockerInterceptor; |
| | | import com.baomidou.mybatisplus.plugins.PaginationInterceptor; |
| | | import com.supersavedriving.user.core.config.properties.DruidProperties; |
| | | import com.supersavedriving.user.core.config.properties.MutiDataSourceProperties; |
| | | import com.supersavedriving.user.core.datascope.DataScopeInterceptor; |
| | | import com.supersavedriving.user.core.mutidatasource.DynamicDataSource; |
| | | import com.supersavedriving.user.core.mutidatasource.aop.MultiSourceExAop; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | | import java.sql.SQLException; |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | | * 多数据源配置<br/> |
| | | * <p> |
| | | * 注:由于引入多数据源,所以让spring事务的aop要在多数据源切换aop的后面 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/20 21:58 |
| | | */ |
| | | @Configuration |
| | | @ConditionalOnProperty(prefix = "guns.muti-datasource", name = "open", havingValue = "true") |
| | | @EnableTransactionManagement(order = 2) |
| | | @MapperScan(basePackages = {"com.supersavedriving.user.modular.*.dao","com.supersavedriving.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.supersavedriving.user.config.datasource; |
| | | |
| | | import com.alibaba.druid.pool.DruidDataSource; |
| | | import com.baomidou.mybatisplus.plugins.OptimisticLockerInterceptor; |
| | | import com.baomidou.mybatisplus.plugins.PaginationInterceptor; |
| | | import com.supersavedriving.user.core.config.properties.DruidProperties; |
| | | import com.supersavedriving.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.supersavedriving.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.supersavedriving.user.config.properties; |
| | | |
| | | import com.supersavedriving.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.supersavedriving.user.config.properties; |
| | | |
| | | import com.supersavedriving.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.supersavedriving.user.config.web; |
| | | |
| | | import com.supersavedriving.user.config.properties.BeetlProperties; |
| | | import com.supersavedriving.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.supersavedriving.user.config.web; |
| | | |
| | | import com.supersavedriving.user.config.properties.GunsProperties; |
| | | import com.supersavedriving.user.core.intercept.GunsUserFilter; |
| | | import com.supersavedriving.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.supersavedriving.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.supersavedriving.user.config.properties.GunsProperties; |
| | | import com.supersavedriving.user.core.intercept.RestApiInteceptor; |
| | | import com.supersavedriving.user.core.listener.ConfigListener; |
| | | import com.supersavedriving.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.supersavedriving.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.supersavedriving.user.core.aop; |
| | | |
| | | import com.supersavedriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.supersavedriving.user.core.common.exception.InvalidKaptchaException; |
| | | import com.supersavedriving.user.core.base.tips.ErrorTip; |
| | | import com.supersavedriving.user.core.exception.GunsException; |
| | | import com.supersavedriving.user.core.log.LogManager; |
| | | import com.supersavedriving.user.core.log.factory.LogTaskFactory; |
| | | import com.supersavedriving.user.core.shiro.ShiroKit; |
| | | import com.supersavedriving.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.supersavedriving.user.core.aop; |
| | | |
| | | import com.supersavedriving.user.core.common.annotion.BussinessLog; |
| | | import com.supersavedriving.user.core.common.constant.dictmap.base.AbstractDictMap; |
| | | import com.supersavedriving.user.core.log.LogManager; |
| | | import com.supersavedriving.user.core.log.LogObjectHolder; |
| | | import com.supersavedriving.user.core.log.factory.LogTaskFactory; |
| | | import com.supersavedriving.user.core.shiro.ShiroKit; |
| | | import com.supersavedriving.user.core.shiro.ShiroUser; |
| | | import com.supersavedriving.user.core.support.HttpKit; |
| | | import com.supersavedriving.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.supersavedriving.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.supersavedriving.user.core.aop; |
| | | |
| | | import com.supersavedriving.user.core.common.annotion.Permission; |
| | | import com.supersavedriving.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.supersavedriving.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.supersavedriving.user.core.beetl; |
| | | |
| | | import com.supersavedriving.user.core.tag.DictSelectorTag; |
| | | import com.supersavedriving.user.core.util.KaptchaUtil; |
| | | import com.supersavedriving.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.supersavedriving.user.core.beetl; |
| | | |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.subject.Subject; |
| | | import org.beetl.core.GroupTemplate; |
| | | |
| | | import com.supersavedriving.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.supersavedriving.user.core.common.annotion; |
| | | |
| | | import com.supersavedriving.user.core.common.constant.dictmap.base.AbstractDictMap; |
| | | import com.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.user.core.common.constant.cache; |
| | | |
| | | /** |
| | | * 所有缓存名称的集合 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-04-24 21:56 |
| | | */ |
| | | public interface Cache { |
| | | |
| | | /** |
| | | * 常量缓存 |
| | | */ |
| | | String CONSTANT = "CONSTANT"; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.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.supersavedriving.user.core.common.constant.dictmap; |
| | | |
| | | import com.supersavedriving.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.supersavedriving.user.core.common.constant.dictmap; |
| | | |
| | | import com.supersavedriving.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.supersavedriving.user.core.common.constant.dictmap; |
| | | |
| | | import com.supersavedriving.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.supersavedriving.user.core.common.constant.dictmap; |
| | | |
| | | import com.supersavedriving.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.supersavedriving.user.core.common.constant.dictmap; |
| | | |
| | | import com.supersavedriving.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.supersavedriving.user.core.common.constant.dictmap; |
| | | |
| | | import com.supersavedriving.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.supersavedriving.user.core.common.constant.dictmap; |
| | | |
| | | import com.supersavedriving.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.supersavedriving.user.core.common.constant.dictmap; |
| | | |
| | | import com.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.user.core.common.constant.dictmap.factory; |
| | | |
| | | import com.supersavedriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.supersavedriving.user.core.common.constant.factory.IConstantFactory; |
| | | import com.supersavedriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.supersavedriving.user.core.exception.GunsException; |
| | | |
| | | import java.lang.reflect.Method; |
| | | |
| | | /** |
| | | * 字典字段的包装器(从ConstantFactory中获取包装值) |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-06 15:12 |
| | | */ |
| | | public class DictFieldWarpperFactory { |
| | | |
| | | public static Object createFieldWarpper(Object parameter, String methodName) { |
| | | IConstantFactory constantFactory = ConstantFactory.me(); |
| | | try { |
| | | Method method = IConstantFactory.class.getMethod(methodName, parameter.getClass()); |
| | | return method.invoke(constantFactory, parameter); |
| | | } catch (Exception e) { |
| | | try { |
| | | Method method = IConstantFactory.class.getMethod(methodName, Integer.class); |
| | | return method.invoke(constantFactory, Integer.parseInt(parameter.toString())); |
| | | } catch (Exception e1) { |
| | | throw new GunsException(BizExceptionEnum.ERROR_WRAPPER_FIELD); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.core.common.constant.factory; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.supersavedriving.user.core.common.constant.cache.Cache; |
| | | import com.supersavedriving.user.core.common.constant.cache.CacheKey; |
| | | import com.supersavedriving.user.core.common.constant.state.ManagerStatus; |
| | | import com.supersavedriving.user.core.common.constant.state.MenuStatus; |
| | | import com.supersavedriving.user.modular.system.dao.*; |
| | | import com.supersavedriving.user.modular.system.model.*; |
| | | import com.supersavedriving.user.core.log.LogObjectHolder; |
| | | import com.supersavedriving.user.core.support.StrKit; |
| | | import com.supersavedriving.user.core.util.Convert; |
| | | import com.supersavedriving.user.core.util.SpringContextHolder; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.dao.*; |
| | | import com.supersavedriving.user.modular.system.model.*; |
| | | 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.supersavedriving.user.core.common.constant.factory; |
| | | |
| | | import com.supersavedriving.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.supersavedriving.user.core.common.constant.factory; |
| | | |
| | | import com.supersavedriving.user.core.support.StrKit; |
| | | import com.supersavedriving.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.supersavedriving.user.core.common.constant.factory; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.supersavedriving.user.core.common.constant.state.Order; |
| | | import com.supersavedriving.user.core.support.HttpKit; |
| | | import com.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.user.core.common.exception; |
| | | |
| | | import com.supersavedriving.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(600, "token过期"), |
| | | TOKEN_ERROR(600, "token验证失败"), |
| | | |
| | | /** |
| | | * 签名异常 |
| | | */ |
| | | SIGN_ERROR(700, "签名验证失败"), |
| | | |
| | | /** |
| | | * 其他 |
| | | */ |
| | | AUTH_REQUEST_ERROR(400, "账号密码错误"); |
| | | |
| | | BizExceptionEnum(int code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | |
| | | private Integer code; |
| | | |
| | | private String message; |
| | | |
| | | @Override |
| | | public Integer getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(Integer code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.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.supersavedriving.user.core.intercept; |
| | | |
| | | import com.supersavedriving.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.supersavedriving.user.core.intercept; |
| | | |
| | | import com.supersavedriving.user.core.base.tips.ErrorTip; |
| | | import com.supersavedriving.user.core.common.constant.JwtConstants; |
| | | import com.supersavedriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.supersavedriving.user.core.util.JwtTokenUtil; |
| | | import com.supersavedriving.user.core.util.RenderUtil; |
| | | import io.jsonwebtoken.JwtException; |
| | | import org.springframework.web.method.HandlerMethod; |
| | | import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | |
| | | /** |
| | | * Rest Api接口鉴权 |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2018/7/20 23:11 |
| | | */ |
| | | public class RestApiInteceptor extends HandlerInterceptorAdapter { |
| | | |
| | | @Override |
| | | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { |
| | | if (handler instanceof org.springframework.web.servlet.resource.ResourceHttpRequestHandler) { |
| | | return true; |
| | | } |
| | | HandlerMethod handlerMethod = (HandlerMethod) handler; |
| | | return check(request, response, handlerMethod); |
| | | } |
| | | |
| | | private boolean check(HttpServletRequest request, HttpServletResponse response, HandlerMethod handlerMethod) { |
| | | if (request.getServletPath().equals(JwtConstants.AUTH_PATH)) { |
| | | return true; |
| | | } |
| | | final String requestHeader = request.getHeader(JwtConstants.AUTH_HEADER); |
| | | String authToken; |
| | | if (requestHeader != null && requestHeader.startsWith("Bearer ")) { |
| | | authToken = requestHeader.substring(7); |
| | | |
| | | //验证token是否过期,包含了验证jwt是否正确 |
| | | try { |
| | | boolean flag = JwtTokenUtil.isTokenExpired(authToken); |
| | | if (flag) { |
| | | RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_EXPIRED.getCode(), BizExceptionEnum.TOKEN_EXPIRED.getMessage())); |
| | | return false; |
| | | } |
| | | } catch (JwtException e) { |
| | | //有异常就是token解析失败 |
| | | RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_ERROR.getCode(), BizExceptionEnum.TOKEN_ERROR.getMessage())); |
| | | return false; |
| | | } |
| | | } else { |
| | | //header没有带Bearer字段 |
| | | RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_ERROR.getCode(), BizExceptionEnum.TOKEN_ERROR.getMessage())); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.core.intercept; |
| | | |
| | | import com.supersavedriving.user.core.base.controller.BaseController; |
| | | import com.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.user.core.log; |
| | | |
| | | import com.supersavedriving.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.supersavedriving.user.core.log.factory; |
| | | |
| | | import com.supersavedriving.user.core.common.constant.state.LogSucceed; |
| | | import com.supersavedriving.user.core.common.constant.state.LogType; |
| | | import com.supersavedriving.user.modular.system.model.LoginLog; |
| | | import com.supersavedriving.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.supersavedriving.user.core.log.factory; |
| | | |
| | | import com.supersavedriving.user.core.common.constant.state.LogSucceed; |
| | | import com.supersavedriving.user.core.common.constant.state.LogType; |
| | | import com.supersavedriving.user.modular.system.dao.LoginLogMapper; |
| | | import com.supersavedriving.user.modular.system.dao.OperationLogMapper; |
| | | import com.supersavedriving.user.modular.system.model.LoginLog; |
| | | import com.supersavedriving.user.modular.system.model.OperationLog; |
| | | import com.supersavedriving.user.core.db.Db; |
| | | import com.supersavedriving.user.core.log.LogManager; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.util.TimerTask; |
| | | |
| | | /** |
| | | * 日志操作任务创建工厂 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年12月6日 下午9:18:27 |
| | | */ |
| | | public class LogTaskFactory { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(LogManager.class); |
| | | private static LoginLogMapper loginLogMapper = Db.getMapper(LoginLogMapper.class); |
| | | private static OperationLogMapper operationLogMapper = Db.getMapper(OperationLogMapper.class); |
| | | |
| | | public static TimerTask loginLog(final Integer userId, final String ip) { |
| | | return new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | LoginLog loginLog = LogFactory.createLoginLog(LogType.LOGIN, userId, null, ip); |
| | | loginLogMapper.insert(loginLog); |
| | | } catch (Exception e) { |
| | | logger.error("创建登录日志异常!", e); |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | |
| | | public static TimerTask loginLog(final String username, final String msg, final String ip) { |
| | | return new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | LoginLog loginLog = LogFactory.createLoginLog( |
| | | LogType.LOGIN_FAIL, null, "账号:" + username + "," + msg, ip); |
| | | try { |
| | | loginLogMapper.insert(loginLog); |
| | | } catch (Exception e) { |
| | | logger.error("创建登录失败异常!", e); |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | |
| | | public static TimerTask exitLog(final Integer userId, final String ip) { |
| | | return new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | LoginLog loginLog = LogFactory.createLoginLog(LogType.EXIT, userId, null,ip); |
| | | try { |
| | | loginLogMapper.insert(loginLog); |
| | | } catch (Exception e) { |
| | | logger.error("创建退出日志异常!", e); |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | |
| | | public static TimerTask bussinessLog(final Integer userId, final String bussinessName, final String clazzName, final String methodName, final String msg) { |
| | | return new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | OperationLog operationLog = LogFactory.createOperationLog( |
| | | LogType.BUSSINESS, userId, bussinessName, clazzName, methodName, msg, LogSucceed.SUCCESS); |
| | | try { |
| | | operationLogMapper.insert(operationLog); |
| | | } catch (Exception e) { |
| | | logger.error("创建业务日志异常!", e); |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | |
| | | public static TimerTask exceptionLog(final Integer userId, final Exception exception) { |
| | | return new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | String msg = ToolUtil.getExceptionMsg(exception); |
| | | OperationLog operationLog = LogFactory.createOperationLog( |
| | | LogType.EXCEPTION, userId, "", null, null, msg, LogSucceed.FAIL); |
| | | try { |
| | | operationLogMapper.insert(operationLog); |
| | | } catch (Exception e) { |
| | | logger.error("创建异常日志异常!", e); |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.core.shiro; |
| | | |
| | | import com.supersavedriving.user.core.shiro.factory.IShiro; |
| | | import com.supersavedriving.user.core.shiro.factory.ShiroFactroy; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.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.supersavedriving.user.core.shiro; |
| | | |
| | | import com.supersavedriving.user.core.common.constant.Const; |
| | | import com.supersavedriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.user.core.shiro.check; |
| | | |
| | | import com.supersavedriving.user.core.listener.ConfigListener; |
| | | import com.supersavedriving.user.core.shiro.ShiroKit; |
| | | import com.supersavedriving.user.core.shiro.ShiroUser; |
| | | import com.supersavedriving.user.core.support.CollectionKit; |
| | | import com.supersavedriving.user.core.support.HttpKit; |
| | | import com.supersavedriving.user.core.util.SpringContextHolder; |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | /** |
| | | * 权限自定义检查 |
| | | */ |
| | | @Service |
| | | @DependsOn("springContextHolder") |
| | | @Transactional(readOnly = true) |
| | | public class PermissionCheckFactory implements ICheck { |
| | | |
| | | public static ICheck me() { |
| | | return SpringContextHolder.getBean(ICheck.class); |
| | | } |
| | | |
| | | @Override |
| | | public boolean check(Object[] permissions) { |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | if (null == user) { |
| | | return false; |
| | | } |
| | | String join = CollectionKit.join(permissions, ","); |
| | | if (ShiroKit.hasAnyRoles(join)) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean checkAll() { |
| | | HttpServletRequest request = HttpKit.getRequest(); |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | if (null == user) { |
| | | return false; |
| | | } |
| | | String requestURI = request.getRequestURI().replaceFirst(ConfigListener.getConf().get("contextPath"), ""); |
| | | String[] str = requestURI.split("/"); |
| | | if (str.length > 3) { |
| | | requestURI = "/" + str[1] + "/" + str[2]; |
| | | } |
| | | if (ShiroKit.hasPermission(requestURI)) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com). |
| | | * <p> |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * <p> |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * <p> |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.supersavedriving.user.core.shiro.check; |
| | | |
| | | import com.supersavedriving.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.supersavedriving.user.core.shiro.factory; |
| | | |
| | | import com.supersavedriving.user.core.shiro.ShiroUser; |
| | | import com.supersavedriving.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.supersavedriving.user.core.shiro.factory; |
| | | |
| | | import com.supersavedriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.supersavedriving.user.core.common.constant.state.ManagerStatus; |
| | | import com.supersavedriving.user.core.shiro.ShiroUser; |
| | | import com.supersavedriving.user.core.util.Convert; |
| | | import com.supersavedriving.user.core.util.SpringContextHolder; |
| | | import com.supersavedriving.user.modular.system.dao.MenuMapper; |
| | | import com.supersavedriving.user.modular.system.dao.UserMapper; |
| | | import com.supersavedriving.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.supersavedriving.user.core.tag; |
| | | |
| | | import com.supersavedriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.supersavedriving.user.core.exception.GunsException; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.model.Dict; |
| | | import com.supersavedriving.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.supersavedriving.user.core.util; |
| | | |
| | | import com.supersavedriving.user.core.common.constant.Const; |
| | | import com.supersavedriving.user.config.properties.GunsProperties; |
| | | import com.supersavedriving.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.supersavedriving.user.core.util; |
| | | |
| | | import com.supersavedriving.user.core.common.constant.dictmap.base.AbstractDictMap; |
| | | import com.supersavedriving.user.core.common.constant.dictmap.factory.DictFieldWarpperFactory; |
| | | import com.supersavedriving.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.supersavedriving.user.core.util; |
| | | |
| | | import com.supersavedriving.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.supersavedriving.user.core.util; |
| | | |
| | | import com.supersavedriving.user.config.properties.GunsProperties; |
| | | |
| | | /** |
| | | * 验证码工具类 |
| | | */ |
| | | public class KaptchaUtil { |
| | | |
| | | /** |
| | | * 获取验证码开关 |
| | | */ |
| | | public static Boolean getKaptchaOnOff() { |
| | | return SpringContextHolder.getBean(GunsProperties.class).getKaptchaOpen(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.api; |
| | | |
| | | import com.supersavedriving.user.core.base.controller.BaseController; |
| | | import com.supersavedriving.user.core.base.tips.ErrorTip; |
| | | import com.supersavedriving.user.core.shiro.ShiroKit; |
| | | import com.supersavedriving.user.core.shiro.ShiroUser; |
| | | import com.supersavedriving.user.core.util.JwtTokenUtil; |
| | | import com.supersavedriving.user.modular.system.dao.UserMapper; |
| | | import com.supersavedriving.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.supersavedriving.user.modular.code.controller; |
| | | |
| | | import com.supersavedriving.user.core.base.controller.BaseController; |
| | | import com.supersavedriving.user.core.config.properties.DruidProperties; |
| | | import com.supersavedriving.user.generator.action.config.WebGeneratorConfig; |
| | | import com.supersavedriving.user.generator.action.model.GenQo; |
| | | import com.supersavedriving.user.modular.code.factory.DefaultTemplateFactory; |
| | | import com.supersavedriving.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.supersavedriving.user.modular.code.factory; |
| | | |
| | | |
| | | import com.supersavedriving.user.GunsApplication; |
| | | import com.supersavedriving.user.core.CoreFlag; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.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.supersavedriving.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.supersavedriving.user.modular.system.auth; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.supersavedriving.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.supersavedriving.user.modular.system.auth; |
| | | |
| | | |
| | | import com.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.user.modular.system.controller; |
| | | |
| | | import com.supersavedriving.user.core.base.controller.BaseController; |
| | | import com.supersavedriving.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.supersavedriving.user.modular.system.controller; |
| | | |
| | | import com.supersavedriving.user.core.base.controller.BaseController; |
| | | import com.supersavedriving.user.core.common.annotion.BussinessLog; |
| | | import com.supersavedriving.user.core.common.annotion.Permission; |
| | | import com.supersavedriving.user.core.common.constant.dictmap.DeptDict; |
| | | import com.supersavedriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.supersavedriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.supersavedriving.user.core.exception.GunsException; |
| | | import com.supersavedriving.user.core.log.LogObjectHolder; |
| | | import com.supersavedriving.user.core.node.ZTreeNode; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.model.Dept; |
| | | import com.supersavedriving.user.modular.system.service.IDeptService; |
| | | import com.supersavedriving.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.supersavedriving.user.modular.system.controller; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.supersavedriving.user.core.base.controller.BaseController; |
| | | import com.supersavedriving.user.core.common.annotion.BussinessLog; |
| | | import com.supersavedriving.user.core.common.annotion.Permission; |
| | | import com.supersavedriving.user.core.common.constant.Const; |
| | | import com.supersavedriving.user.core.common.constant.dictmap.DictMap; |
| | | import com.supersavedriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.supersavedriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.supersavedriving.user.core.exception.GunsException; |
| | | import com.supersavedriving.user.core.log.LogObjectHolder; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.model.Dict; |
| | | import com.supersavedriving.user.modular.system.service.IDictService; |
| | | import com.supersavedriving.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.supersavedriving.user.modular.system.controller; |
| | | |
| | | import com.google.code.kaptcha.Constants; |
| | | import com.google.code.kaptcha.Producer; |
| | | import com.supersavedriving.user.config.properties.GunsProperties; |
| | | import com.supersavedriving.user.core.util.FileUtil; |
| | | 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.supersavedriving.user.modular.system.controller; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.SqlRunner; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.supersavedriving.user.core.base.controller.BaseController; |
| | | import com.supersavedriving.user.core.common.annotion.BussinessLog; |
| | | import com.supersavedriving.user.core.common.annotion.Permission; |
| | | import com.supersavedriving.user.core.common.constant.Const; |
| | | import com.supersavedriving.user.core.common.constant.factory.PageFactory; |
| | | import com.supersavedriving.user.core.common.constant.state.BizLogType; |
| | | import com.supersavedriving.user.core.support.BeanKit; |
| | | import com.supersavedriving.user.modular.system.model.OperationLog; |
| | | import com.supersavedriving.user.modular.system.service.IOperationLogService; |
| | | import com.supersavedriving.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.supersavedriving.user.modular.system.controller; |
| | | |
| | | import com.google.code.kaptcha.Constants; |
| | | import com.supersavedriving.user.core.base.controller.BaseController; |
| | | import com.supersavedriving.user.core.common.exception.InvalidKaptchaException; |
| | | import com.supersavedriving.user.core.log.LogManager; |
| | | import com.supersavedriving.user.core.log.factory.LogTaskFactory; |
| | | import com.supersavedriving.user.core.node.MenuNode; |
| | | import com.supersavedriving.user.core.shiro.ShiroKit; |
| | | import com.supersavedriving.user.core.shiro.ShiroUser; |
| | | import com.supersavedriving.user.core.util.ApiMenuFilter; |
| | | import com.supersavedriving.user.core.util.KaptchaUtil; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.model.User; |
| | | import com.supersavedriving.user.modular.system.service.IMenuService; |
| | | import com.supersavedriving.user.modular.system.service.IUserService; |
| | | import com.supersavedriving.user.core.support.HttpKit; |
| | | 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.supersavedriving.user.modular.system.controller; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.SqlRunner; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.supersavedriving.user.core.base.controller.BaseController; |
| | | import com.supersavedriving.user.core.common.annotion.BussinessLog; |
| | | import com.supersavedriving.user.core.common.annotion.Permission; |
| | | import com.supersavedriving.user.core.common.constant.Const; |
| | | import com.supersavedriving.user.core.common.constant.factory.PageFactory; |
| | | import com.supersavedriving.user.modular.system.model.LoginLog; |
| | | import com.supersavedriving.user.modular.system.service.ILoginLogService; |
| | | import com.supersavedriving.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.supersavedriving.user.modular.system.controller; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.supersavedriving.user.core.base.controller.BaseController; |
| | | import com.supersavedriving.user.core.base.tips.Tip; |
| | | import com.supersavedriving.user.core.common.annotion.BussinessLog; |
| | | import com.supersavedriving.user.core.common.annotion.Permission; |
| | | import com.supersavedriving.user.core.common.constant.Const; |
| | | import com.supersavedriving.user.core.common.constant.dictmap.MenuDict; |
| | | import com.supersavedriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.supersavedriving.user.core.common.constant.state.MenuStatus; |
| | | import com.supersavedriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.supersavedriving.user.core.exception.GunsException; |
| | | import com.supersavedriving.user.core.log.LogObjectHolder; |
| | | import com.supersavedriving.user.core.node.ZTreeNode; |
| | | import com.supersavedriving.user.core.support.BeanKit; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.model.Menu; |
| | | import com.supersavedriving.user.modular.system.service.IMenuService; |
| | | import com.supersavedriving.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.supersavedriving.user.modular.system.controller; |
| | | |
| | | import com.supersavedriving.user.core.base.controller.BaseController; |
| | | import com.supersavedriving.user.core.common.annotion.BussinessLog; |
| | | import com.supersavedriving.user.core.common.constant.dictmap.NoticeMap; |
| | | import com.supersavedriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.supersavedriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.supersavedriving.user.core.exception.GunsException; |
| | | import com.supersavedriving.user.core.log.LogObjectHolder; |
| | | import com.supersavedriving.user.core.shiro.ShiroKit; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.model.Notice; |
| | | import com.supersavedriving.user.modular.system.service.INoticeService; |
| | | import com.supersavedriving.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.supersavedriving.user.modular.system.controller; |
| | | |
| | | import com.supersavedriving.user.core.base.controller.BaseController; |
| | | import com.supersavedriving.user.core.base.tips.Tip; |
| | | import com.supersavedriving.user.core.cache.CacheKit; |
| | | import com.supersavedriving.user.core.common.annotion.BussinessLog; |
| | | import com.supersavedriving.user.core.common.annotion.Permission; |
| | | import com.supersavedriving.user.core.common.constant.Const; |
| | | import com.supersavedriving.user.core.common.constant.cache.Cache; |
| | | import com.supersavedriving.user.core.common.constant.dictmap.RoleDict; |
| | | import com.supersavedriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.supersavedriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.supersavedriving.user.core.exception.GunsException; |
| | | import com.supersavedriving.user.core.log.LogObjectHolder; |
| | | import com.supersavedriving.user.core.node.ZTreeNode; |
| | | import com.supersavedriving.user.core.util.Convert; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.model.Role; |
| | | import com.supersavedriving.user.modular.system.model.User; |
| | | import com.supersavedriving.user.modular.system.service.IRoleService; |
| | | import com.supersavedriving.user.modular.system.service.IUserService; |
| | | import com.supersavedriving.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.supersavedriving.user.modular.system.controller; |
| | | |
| | | import com.supersavedriving.user.config.properties.GunsProperties; |
| | | import com.supersavedriving.user.core.base.controller.BaseController; |
| | | import com.supersavedriving.user.core.base.tips.Tip; |
| | | import com.supersavedriving.user.core.common.annotion.BussinessLog; |
| | | import com.supersavedriving.user.core.common.annotion.Permission; |
| | | import com.supersavedriving.user.core.common.constant.Const; |
| | | import com.supersavedriving.user.core.common.constant.dictmap.UserDict; |
| | | import com.supersavedriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.supersavedriving.user.core.common.constant.state.ManagerStatus; |
| | | import com.supersavedriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.supersavedriving.user.core.datascope.DataScope; |
| | | import com.supersavedriving.user.core.db.Db; |
| | | import com.supersavedriving.user.core.exception.GunsException; |
| | | import com.supersavedriving.user.core.log.LogObjectHolder; |
| | | import com.supersavedriving.user.core.shiro.ShiroKit; |
| | | import com.supersavedriving.user.core.shiro.ShiroUser; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.dao.UserMapper; |
| | | import com.supersavedriving.user.modular.system.factory.UserFactory; |
| | | import com.supersavedriving.user.modular.system.model.User; |
| | | import com.supersavedriving.user.modular.system.service.IUserService; |
| | | import com.supersavedriving.user.modular.system.transfer.UserDto; |
| | | import com.supersavedriving.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.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.core.node.ZTreeNode; |
| | | import com.supersavedriving.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.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.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.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.supersavedriving.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.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.core.node.MenuNode; |
| | | import com.supersavedriving.user.core.node.ZTreeNode; |
| | | import com.supersavedriving.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.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.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.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.supersavedriving.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.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.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.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.modular.system.model.Relation; |
| | | |
| | | /** |
| | | * <p> |
| | | * 角色和菜单关联表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | public interface RelationMapper extends BaseMapper<Relation> { |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.core.node.ZTreeNode; |
| | | import com.supersavedriving.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.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.core.datascope.DataScope; |
| | | import com.supersavedriving.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 |
| | |
| | | <?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.supersavedriving.user.modular.system.dao.DeptMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.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.supersavedriving.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.supersavedriving.user.modular.system.dao.DictMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.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.supersavedriving.user.modular.system.dao.LoginLogMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.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.supersavedriving.user.modular.system.dao.MenuMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.user.modular.system.dao.NoticeMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.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.supersavedriving.user.modular.system.dao.OperationLogMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.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.supersavedriving.user.modular.system.dao.RegionMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.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.supersavedriving.user.modular.system.dao.RelationMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.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.supersavedriving.user.modular.system.dao.RoleMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.user.modular.system.dao.UserMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.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 |
| | |
| | | package com.supersavedriving.user.modular.system.factory; |
| | | |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.model.User; |
| | | import com.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.core.node.ZTreeNode; |
| | | import com.supersavedriving.user.modular.system.model.Dept; |
| | | 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.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.Dict; |
| | | 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.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.LoginLog; |
| | | |
| | | 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.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.core.node.MenuNode; |
| | | import com.supersavedriving.user.core.node.ZTreeNode; |
| | | import com.supersavedriving.user.modular.system.model.Menu; |
| | | 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.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.Notice; |
| | | |
| | | 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.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.OperationLog; |
| | | |
| | | 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.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.Relation; |
| | | |
| | | /** |
| | | * <p> |
| | | * 角色和菜单关联表 服务类 |
| | | * </p> |
| | | * |
| | | * @author stylefeng123 |
| | | * @since 2018-02-22 |
| | | */ |
| | | public interface IRelationService extends IService<Relation> { |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.core.node.ZTreeNode; |
| | | import com.supersavedriving.user.modular.system.model.Role; |
| | | 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.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.core.datascope.DataScope; |
| | | import com.supersavedriving.user.modular.system.model.User; |
| | | 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.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.core.node.ZTreeNode; |
| | | import com.supersavedriving.user.modular.system.dao.DeptMapper; |
| | | import com.supersavedriving.user.modular.system.model.Dept; |
| | | import com.supersavedriving.user.modular.system.service.IDeptService; |
| | | 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.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.core.common.exception.BizExceptionEnum; |
| | | import com.supersavedriving.user.core.exception.GunsException; |
| | | import com.supersavedriving.user.modular.system.dao.DictMapper; |
| | | import com.supersavedriving.user.modular.system.model.Dict; |
| | | import com.supersavedriving.user.modular.system.service.IDictService; |
| | | import com.supersavedriving.user.core.common.constant.factory.MutiStrFactory; |
| | | 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.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.modular.system.dao.LoginLogMapper; |
| | | import com.supersavedriving.user.modular.system.model.LoginLog; |
| | | import com.supersavedriving.user.modular.system.service.ILoginLogService; |
| | | 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.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.core.node.MenuNode; |
| | | import com.supersavedriving.user.core.node.ZTreeNode; |
| | | import com.supersavedriving.user.modular.system.dao.MenuMapper; |
| | | import com.supersavedriving.user.modular.system.model.Menu; |
| | | import com.supersavedriving.user.modular.system.service.IMenuService; |
| | | 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.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.modular.system.dao.NoticeMapper; |
| | | import com.supersavedriving.user.modular.system.model.Notice; |
| | | import com.supersavedriving.user.modular.system.service.INoticeService; |
| | | 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.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.modular.system.dao.OperationLogMapper; |
| | | import com.supersavedriving.user.modular.system.model.OperationLog; |
| | | import com.supersavedriving.user.modular.system.service.IOperationLogService; |
| | | 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.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.modular.system.dao.RelationMapper; |
| | | import com.supersavedriving.user.modular.system.model.Relation; |
| | | import com.supersavedriving.user.modular.system.service.IRelationService; |
| | | 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.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.core.node.ZTreeNode; |
| | | import com.supersavedriving.user.core.util.Convert; |
| | | import com.supersavedriving.user.modular.system.dao.RelationMapper; |
| | | import com.supersavedriving.user.modular.system.dao.RoleMapper; |
| | | import com.supersavedriving.user.modular.system.model.Relation; |
| | | import com.supersavedriving.user.modular.system.model.Role; |
| | | import com.supersavedriving.user.modular.system.service.IRoleService; |
| | | 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.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.core.datascope.DataScope; |
| | | import com.supersavedriving.user.modular.system.dao.UserMapper; |
| | | import com.supersavedriving.user.modular.system.model.User; |
| | | import com.supersavedriving.user.modular.system.service.IUserService; |
| | | 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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.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.supersavedriving.user.modular.system.util; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 阿里云API接口工具类 |
| | | */ |
| | | @Component |
| | | public class ALiApiUtil { |
| | | |
| | | @Autowired |
| | | private HttpClientUtil httpClientUtil; |
| | | |
| | | |
| | | /** |
| | | * 身份认证接口 |
| | | * @param name 姓名 |
| | | * @param code 身份证号 |
| | | * @return |
| | | */ |
| | | public boolean authentication(String name, String code){ |
| | | String url = "https://safrvcert.market.alicloudapi.com/safrv_2meta_id_name/"; |
| | | Map<String, String> header = new HashMap<>(); |
| | | header.put("Authorization", "APPCODE b7d32437d08149099457dcb50fb57df2"); |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("__userId", "1732960796168165"); |
| | | param.put("verifyKey", "IVO4js5kValcdt"); |
| | | param.put("userName", name); |
| | | param.put("identifyNum", code); |
| | | String get = httpClientUtil.pushHttpRequset("GET", url, param, header, "form"); |
| | | JSONObject jsonObject = JSON.parseObject(get); |
| | | if(jsonObject.getIntValue("code") == 200){ |
| | | JSONObject value = jsonObject.getJSONObject("value"); |
| | | if(value.getIntValue("bizCode") == 0){ |
| | | return true; |
| | | }else{ |
| | | return false; |
| | | } |
| | | }else{ |
| | | System.err.println(jsonObject.getString("message")); |
| | | } |
| | | return false; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.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.supersavedriving.user.modular.system.util; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.supersavedriving.user.core.util.MD5Util; |
| | | import org.apache.commons.codec.binary.Base64; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 中国移动工具类 |
| | | */ |
| | | @Component |
| | | public class ChinaMobileUtil { |
| | | |
| | | private String APIKey = "zj42494b1bdd416b9762229af6b5cbbd"; |
| | | |
| | | private String SecretKey = "30323561316534653735613230316339"; |
| | | |
| | | @Autowired |
| | | private HttpClientUtil httpClientUtil; |
| | | |
| | | |
| | | /** |
| | | * 绑定小号 |
| | | * @param phoneA |
| | | * @param phoneB |
| | | * @param areaCode |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public Map<String, String> midAxbBindSend(String phoneA, String phoneB, Integer areaCode) throws Exception{ |
| | | //组装请求对象-具体描述见开发文档-订单小号-AXB接口规范部分内容 |
| | | Map<String, Object> request = new HashMap<>(); |
| | | request.put("APPID", APIKey); |
| | | request.put("bindtype", "AXB"); |
| | | request.put("requestId", UUIDUtil.getRandomCode(16)); |
| | | request.put("record", "0"); |
| | | //用户号码,必填,格式遵循国际电信联盟定义的E.164标准 |
| | | request.put("telA", "86" + phoneA); |
| | | //用户号码B,必填,格式遵循国际电信联盟定义的E.164标准 |
| | | request.put("telB", "86" + phoneB); |
| | | //需要选择的小号所属区号,当telX不写时必填,例如:杭州(571) |
| | | request.put("areaCode", 571); |
| | | //订单小号,非必填,当指定小号绑定时填写,格式遵循国际电信联盟定义的E.164标准 |
| | | // request.setTelX("8618867110000"); |
| | | //绑定关系过期失效时间,秒,取值必须大于0且最大值不超过4294967296 |
| | | request.put("expiration", Integer.valueOf(7 * 24 * 60 * 60)); |
| | | |
| | | Map<String, String> header = new HashMap<String, String>(3); |
| | | header.put("Authorization", "Basic " + new String(Base64.encodeBase64((APIKey + ":" + SecretKey).getBytes()))); |
| | | header.put("Content-Type", "application/json;charset=utf-8"); |
| | | String post = httpClientUtil.pushHttpRequset("POST", "https://ct.open.10086.cn/ordernumber/v1/binding", request, header, "json"); |
| | | Map<String, String> map1 = new HashMap<>(); |
| | | if(post.indexOf("0000") != -1){ |
| | | JSONObject jsonObject = JSONObject.parseObject(post); |
| | | if(jsonObject.getString("code").equals("0000")){ |
| | | map1.put("code", "200"); |
| | | map1.put("msg", jsonObject.getString("message")); |
| | | map1.put("telX", jsonObject.getString("x_no").substring(2)); |
| | | map1.put("bindId", jsonObject.getString("bindId")); |
| | | }else{ |
| | | map1.put("code", jsonObject.getString("code")); |
| | | map1.put("msg", jsonObject.getString("message")); |
| | | } |
| | | }else{ |
| | | map1.put("code", "-1"); |
| | | map1.put("msg", post); |
| | | } |
| | | |
| | | return map1; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 解绑小号关系 |
| | | * @param bindId 绑定关系id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public Map<String, String> midAxbUnBindSend(String bindId) throws Exception{ |
| | | //组装请求对象-具体描述见开发文档-订单小号-AXB接口规范部分内容 |
| | | Map<String, Object> request = new HashMap<>(); |
| | | //绑定关系ID |
| | | request.put("APPID", APIKey); |
| | | request.put("bindId", bindId); |
| | | |
| | | Map<String, String> header = new HashMap<String, String>(3); |
| | | header.put("Authorization", "Basic " + new String(Base64.encodeBase64((APIKey + ":" + SecretKey).getBytes()))); |
| | | header.put("Content-Type", "application/json;charset=utf-8"); |
| | | String post = httpClientUtil.pushHttpRequset("POST", "https://ct.open.10086.cn/ordernumber/v1/unbinding", request, header, "json"); |
| | | Map<String, String> map1 = new HashMap<>(); |
| | | if(post.indexOf("0000") != -1){ |
| | | JSONObject jsonObject = JSONObject.parseObject(post); |
| | | if(jsonObject.getString("code").equals("0000")){ |
| | | map1.put("code", "200"); |
| | | map1.put("msg", jsonObject.getString("message")); |
| | | }else{ |
| | | map1.put("code", jsonObject.getString("code")); |
| | | map1.put("msg", jsonObject.getString("message")); |
| | | } |
| | | }else{ |
| | | map1.put("code", "-1"); |
| | | map1.put("msg", post); |
| | | } |
| | | return map1; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public Map<String, String> HeaderUtils(String APIKey, String SecretKey) throws Exception{ |
| | | Map<String, String> header = new HashMap<>(); |
| | | long time = System.currentTimeMillis(); |
| | | String signStr = MD5Util.encrypt(APIKey + SecretKey + time); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("apiKey", APIKey); |
| | | jsonObject.put("time", time); |
| | | jsonObject.put("sign", signStr); |
| | | Base64 base64 = new Base64(); |
| | | String s = base64.encodeToString(jsonObject.toJSONString().getBytes("UTF-8")); |
| | | header.put("header", s); |
| | | |
| | | jsonObject = new JSONObject(); |
| | | jsonObject.put("platformId", ""); |
| | | jsonObject.put("secret", ""); |
| | | s = base64.encodeToString(jsonObject.toJSONString().getBytes("UTF-8")); |
| | | header.put("accessCode", s); |
| | | return header; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util; |
| | | |
| | | import com.supersavedriving.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.supersavedriving.user.modular.system.util; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.ApplicationArguments; |
| | | import org.springframework.boot.ApplicationRunner; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.LinkedMultiValueMap; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * 高德猎鹰服务 |
| | | */ |
| | | @Component |
| | | public class GDFalconUtil implements ApplicationRunner { |
| | | |
| | | private String key = "e17d799b2506d05faf7f88320a266803"; |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | | |
| | | private static String serverId = null; |
| | | |
| | | |
| | | public String getServerId() { |
| | | return serverId; |
| | | } |
| | | |
| | | /** |
| | | * 服务启动后执行的代码 |
| | | * @param args |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void run(ApplicationArguments args) throws Exception { |
| | | this.init(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 初始化创建服务 |
| | | */ |
| | | public void init(){ |
| | | if(serverId == null){ |
| | | JSONArray jsonArray = this.selectServer(); |
| | | if(null == jsonArray){ |
| | | serverId = this.createServer("server"); |
| | | }else{ |
| | | serverId = jsonArray.getJSONObject(0).getString("sid"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建新的服务 |
| | | * @return |
| | | */ |
| | | public String createServer(String name){ |
| | | String url = "https://tsapi.amap.com/v1/track/service/add"; |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("key", key); |
| | | params.add("name", name); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = restTemplate.postForObject(url, requestEntity , String.class); |
| | | JSONObject jsonObject = JSON.parseObject(s); |
| | | if(jsonObject.getIntValue("errcode") == 10000){ |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | if(null != data){ |
| | | return data.getString("sid"); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询服务 |
| | | * @return |
| | | */ |
| | | private JSONArray selectServer(){ |
| | | String url = "https://tsapi.amap.com/v1/track/service/list?key=" + key; |
| | | String forObject = restTemplate.getForObject(url, String.class); |
| | | JSONObject jsonObject = JSON.parseObject(forObject); |
| | | if(jsonObject.getIntValue("errcode") == 10000){ |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | if(null != data){ |
| | | return data.getJSONArray("results"); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建终端数据 |
| | | * @param name |
| | | * @return |
| | | */ |
| | | public String createTerminal(String name){ |
| | | String tid = this.selectTerminal(name); |
| | | if(tid != null){ |
| | | return tid; |
| | | } |
| | | String url = "https://tsapi.amap.com/v1/track/terminal/add"; |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("key", key); |
| | | params.add("sid", serverId); |
| | | params.add("name", name); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = restTemplate.postForObject(url, requestEntity , String.class); |
| | | JSONObject jsonObject = JSON.parseObject(s); |
| | | if(jsonObject.getIntValue("errcode") == 10000){ |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | return data.getString("tid"); |
| | | } |
| | | System.err.println(jsonObject.getString("errmsg")); |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询终端 |
| | | * @param name |
| | | * @return |
| | | */ |
| | | public String selectTerminal(String name){ |
| | | String url = "https://tsapi.amap.com/v1/track/terminal/list?key=" + key + "&name=" + name; |
| | | String forObject = restTemplate.getForObject(url, String.class); |
| | | JSONObject jsonObject = JSON.parseObject(forObject); |
| | | if(jsonObject.getIntValue("errcode") == 10000){ |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | int count = 0; |
| | | if(null != data){ |
| | | count = data.getIntValue("count"); |
| | | } |
| | | if(count > 0){ |
| | | JSONObject results = data.getJSONArray("results").getJSONObject(0); |
| | | return results.getString("tid"); |
| | | }else{ |
| | | return this.createTerminal(name); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建轨迹 |
| | | * @param tid 终端id |
| | | * @return |
| | | */ |
| | | public String createTrack(String tid){ |
| | | String url = "https://tsapi.amap.com/v1/track/trace/add"; |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("key", key); |
| | | params.add("sid", serverId); |
| | | params.add("tid", tid); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = restTemplate.postForObject(url, requestEntity , String.class); |
| | | JSONObject jsonObject = JSON.parseObject(s); |
| | | if(jsonObject.getIntValue("errcode") == 10000){ |
| | | return jsonObject.getString("data"); |
| | | } |
| | | System.err.println(jsonObject.getString("errmsg")); |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除轨迹 |
| | | * @param tid 终端id |
| | | * @param trid 轨迹id |
| | | */ |
| | | public void deleteTrack(String tid, String trid){ |
| | | String url = "https://tsapi.amap.com/v1/track/trace/delete"; |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("key", key); |
| | | params.add("sid", serverId); |
| | | params.add("tid", tid); |
| | | params.add("trid", trid); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = restTemplate.postForObject(url, requestEntity , String.class); |
| | | JSONObject jsonObject = JSON.parseObject(s); |
| | | if(jsonObject.getIntValue("errcode") != 10000){ |
| | | System.err.println(jsonObject.getString("errmsg")); |
| | | } |
| | | } |
| | | |
| | | |
| | | // |
| | | // public Map<String, Object> queryTrsearch(){ |
| | | // |
| | | // } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util; |
| | | |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import org.gavaghan.geodesy.Ellipsoid; |
| | | import org.gavaghan.geodesy.GeodeticCalculator; |
| | | import org.gavaghan.geodesy.GeodeticCurve; |
| | | import org.gavaghan.geodesy.GlobalCoordinates; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 计算两个金纬度坐标之间的直线距离 |
| | | */ |
| | | @Component |
| | | public class GeodesyUtil { |
| | | |
| | | |
| | | /** |
| | | * 获取直线距离 |
| | | * @param fromLonLat |
| | | * @param toLonLat |
| | | * @return |
| | | */ |
| | | public Map<String, Double> getDistance(String fromLonLat, String toLonLat){ |
| | | Map<String, Double> map = null; |
| | | if(ToolUtil.isNotEmpty(fromLonLat) && ToolUtil.isNotEmpty(toLonLat)){ |
| | | map = new HashMap<>(); |
| | | String[] from = fromLonLat.split(","); |
| | | String[] to = toLonLat.split(","); |
| | | GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(from[1]), Double.valueOf(from[0])); |
| | | GlobalCoordinates target = new GlobalCoordinates(Double.valueOf(to[1]), Double.valueOf(to[0])); |
| | | double Sphere = getDistanceMeter(source, target, Ellipsoid.Sphere); |
| | | double WGS84 = getDistanceMeter(source, target, Ellipsoid.WGS84); |
| | | double GRS80 = getDistanceMeter(source, target, Ellipsoid.GRS80); |
| | | double GRS67 = getDistanceMeter(source, target, Ellipsoid.GRS67); |
| | | double ANS = getDistanceMeter(source, target, Ellipsoid.ANS); |
| | | double WGS72 = getDistanceMeter(source, target, Ellipsoid.WGS72); |
| | | double Clarke1858 = getDistanceMeter(source, target, Ellipsoid.Clarke1858); |
| | | double Clarke1880 = getDistanceMeter(source, target, Ellipsoid.Clarke1880); |
| | | // System.out.println("Sphere坐标系计算结果:"+Sphere + "米"); |
| | | // System.out.println("WGS84坐标系计算结果:"+WGS84 + "米"); |
| | | // System.out.println("GRS80坐标系计算结果:"+GRS80 + "米"); |
| | | // System.out.println("GRS67坐标系计算结果:"+GRS67 + "米"); |
| | | // System.out.println("ANS坐标系计算结果:"+ANS + "米"); |
| | | // System.out.println("WGS72坐标系计算结果:"+WGS72 + "米"); |
| | | // System.out.println("Clarke1858坐标系计算结果:"+Clarke1858 + "米"); |
| | | // System.out.println("Clarke1880坐标系计算结果:"+Clarke1880 + "米"); |
| | | map.put("Sphere", Sphere); |
| | | map.put("WGS84", WGS84); |
| | | map.put("GRS80", GRS80); |
| | | map.put("GRS67", GRS67); |
| | | map.put("ANS", ANS); |
| | | map.put("WGS72", WGS72); |
| | | map.put("Clarke1858", Clarke1858); |
| | | map.put("Clarke1880", Clarke1880); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | |
| | | private double getDistanceMeter(GlobalCoordinates gpsFrom, GlobalCoordinates gpsTo, Ellipsoid ellipsoid){ |
| | | //创建GeodeticCalculator,调用计算方法,传入坐标系、经纬度用于计算距离 |
| | | GeodeticCurve geoCurve = new GeodeticCalculator().calculateGeodeticCurve(ellipsoid, gpsFrom, gpsTo); |
| | | return geoCurve.getEllipsoidalDistance(); |
| | | } |
| | | |
| | | |
| | | |
| | | public static void main(String[] ages){ |
| | | GeodesyUtil geodesyUtil = new GeodesyUtil(); |
| | | geodesyUtil.getDistance("115.481028,39.989643", "114.465302,40.004717"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util; |
| | | |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.apache.http.NameValuePair; |
| | | import org.apache.http.client.config.RequestConfig; |
| | | import org.apache.http.client.entity.UrlEncodedFormEntity; |
| | | import org.apache.http.client.methods.CloseableHttpResponse; |
| | | import org.apache.http.client.methods.HttpGet; |
| | | import org.apache.http.client.methods.HttpPost; |
| | | import org.apache.http.entity.StringEntity; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; |
| | | import org.apache.http.message.BasicNameValuePair; |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.IOException; |
| | | import java.nio.charset.Charset; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * http工具类 |
| | | */ |
| | | @Component |
| | | public class HttpClientUtil { |
| | | |
| | | private CloseableHttpClient httpClient; |
| | | |
| | | private CloseableHttpResponse httpResponse; |
| | | |
| | | private RequestConfig requestConfig; |
| | | |
| | | |
| | | /** |
| | | * 创建一个httpClient对象 |
| | | */ |
| | | private void getHttpCline(){ |
| | | //1.创建连接池管理器 |
| | | PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(60000, |
| | | TimeUnit.MILLISECONDS); |
| | | connectionManager.setMaxTotal(1000); |
| | | connectionManager.setDefaultMaxPerRoute(50); |
| | | |
| | | //2.创建httpclient对象 |
| | | this.httpClient = HttpClients.custom() |
| | | .setConnectionManager(connectionManager) |
| | | .disableAutomaticRetries() |
| | | .build(); |
| | | } |
| | | |
| | | private RequestConfig getRequestConfig(){ |
| | | return RequestConfig.custom() |
| | | .setConnectTimeout(60000) |
| | | .setSocketTimeout(60000) |
| | | .build(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 创建一个POST请求实例 |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | */ |
| | | private void setPostHttpRequset(String url, Map<String, Object> params, Map<String, String> header, String contentType){ |
| | | HttpPost httpPost = new HttpPost(url); |
| | | httpPost.setConfig(this.getRequestConfig()); |
| | | if(null != header){ |
| | | for(String key : header.keySet()){ |
| | | httpPost.setHeader(key, header.get(key)); |
| | | } |
| | | } |
| | | List<NameValuePair> list = new ArrayList<>(); |
| | | if(null != params){ |
| | | Set<String> keys = params.keySet(); |
| | | for(String key : keys){ |
| | | list.add(new BasicNameValuePair(key, params.get(key).toString())); |
| | | } |
| | | } |
| | | try { |
| | | switch (contentType){ |
| | | case "form": |
| | | httpPost.setEntity(new UrlEncodedFormEntity(list, "UTF-8")); |
| | | break; |
| | | case "json": |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | String s =objectMapper.writeValueAsString(params); |
| | | System.err.println(s); |
| | | httpPost.setEntity(new StringEntity(s, Charset.forName("UTF-8"))); |
| | | break; |
| | | } |
| | | this.getHttpCline(); |
| | | if(null == this.httpClient){ |
| | | this.getHttpCline(); |
| | | } |
| | | httpResponse = this.httpClient.execute(httpPost); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | this.close(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取get请求实例 |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | */ |
| | | private void setGetHttpRequset(String url, Map<String, Object> params, Map<String, String> header){ |
| | | StringBuffer sb = new StringBuffer(); |
| | | String p = ""; |
| | | if(null != params){ |
| | | Set<String> keys = params.keySet(); |
| | | for(String key : keys){ |
| | | sb.append(key + "=" + params.get(key) + "&"); |
| | | } |
| | | p = "?" + sb.substring(0, sb.length() - 1); |
| | | } |
| | | HttpGet httpGet = new HttpGet(url + p); |
| | | if(null != header){ |
| | | for(String key : header.keySet()){ |
| | | httpGet.setHeader(key, header.get(key)); |
| | | } |
| | | } |
| | | this.getHttpCline(); |
| | | if(null == this.httpClient){ |
| | | this.getHttpCline(); |
| | | } |
| | | try { |
| | | httpResponse = this.httpClient.execute(httpGet); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | this.close(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送http请求 |
| | | * @param mothed "GET、POST、PUT、HEAD、DELETE、HEAD、OPTIONS" |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | * @param header 请求头 |
| | | * @param contentType 参数请求方式form/json |
| | | * @return |
| | | */ |
| | | public String pushHttpRequset(String mothed, String url, Map<String, Object> params, Map<String, String> header, String contentType){ |
| | | String content = null; |
| | | switch (mothed){ |
| | | case "GET": |
| | | this.setGetHttpRequset(url, params, header); |
| | | break; |
| | | case "POST": |
| | | this.setPostHttpRequset(url, params, header, contentType); |
| | | break; |
| | | } |
| | | if(httpResponse.getStatusLine().getStatusCode() == 200){ |
| | | try { |
| | | content = EntityUtils.toString(httpResponse.getEntity()); |
| | | this.close(); |
| | | return content; |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | this.close(); |
| | | } |
| | | } |
| | | if(httpResponse.getStatusLine().getStatusCode() == 201){ |
| | | content = "{\"status\":201}"; |
| | | this.close(); |
| | | return content; |
| | | }else{ |
| | | try { |
| | | System.err.println("返回状态码:" + httpResponse.getStatusLine() + "。"); |
| | | content = EntityUtils.toString(httpResponse.getEntity()); |
| | | this.close(); |
| | | return content; |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | this.close(); |
| | | } |
| | | } |
| | | this.close(); |
| | | return content; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送XML请求 |
| | | * @param url 请求地址 |
| | | * @param xml XML数据 |
| | | * @param header 自定义请求头 |
| | | * @return |
| | | */ |
| | | public String pushHttpRequsetXml(String url, String xml, Map<String, String> header){ |
| | | HttpPost httpPost = new HttpPost(url); |
| | | for(String key : header.keySet()){ |
| | | httpPost.setHeader(key, header.get(key)); |
| | | } |
| | | httpPost.setHeader("Content-Type", "application/xml"); |
| | | try { |
| | | httpPost.setEntity(new StringEntity(xml, "UTF-8")); |
| | | this.getHttpCline(); |
| | | if(null == this.httpClient){ |
| | | this.getHttpCline(); |
| | | } |
| | | httpResponse = this.httpClient.execute(httpPost); |
| | | String content = null; |
| | | if(httpResponse.getStatusLine().getStatusCode() == 200){ |
| | | try { |
| | | content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); |
| | | this.close(); |
| | | return content; |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | this.close(); |
| | | } |
| | | }else{ |
| | | try { |
| | | content = "返回状态码:" + httpResponse.getStatusLine() + "。" + EntityUtils.toString(httpResponse.getEntity()); |
| | | this.close(); |
| | | return content; |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | this.close(); |
| | | } |
| | | } |
| | | this.close(); |
| | | return content; |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | this.close(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 关闭资源 |
| | | */ |
| | | private void close(){ |
| | | try { |
| | | if(null != httpClient){ |
| | | httpClient.close(); |
| | | } |
| | | if(null != httpResponse){ |
| | | httpResponse.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | try { |
| | | if(null != httpClient){ |
| | | httpClient.close(); |
| | | } |
| | | if(null != httpResponse){ |
| | | httpResponse.close(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util; |
| | | |
| | | import cn.jiguang.common.ClientConfig; |
| | | import cn.jiguang.common.resp.APIConnectionException; |
| | | import cn.jiguang.common.resp.APIRequestException; |
| | | import cn.jpush.api.JPushClient; |
| | | import cn.jpush.api.push.PushResult; |
| | | import cn.jpush.api.push.model.Platform; |
| | | import cn.jpush.api.push.model.PushPayload; |
| | | import cn.jpush.api.push.model.audience.Audience; |
| | | import cn.jpush.api.push.model.notification.Notification; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 极光推送工具类 |
| | | */ |
| | | @Component |
| | | public class JGPushUtil { |
| | | |
| | | @Value("${jiguang.appKey-driver}") |
| | | private String appKeyDriver; |
| | | |
| | | @Value("${jiguang.masterSecret-driver}") |
| | | private String masterSecretDriver; |
| | | |
| | | @Value("${jiguang.appKey-dispatch}") |
| | | private String appKeyDispatch; |
| | | |
| | | @Value("${jiguang.masterSecret-dispatch}") |
| | | private String masterSecretDispatch; |
| | | |
| | | |
| | | private PushPayload buildPushObject_all_all_alert(String content, String...tags) { |
| | | return PushPayload.newBuilder() |
| | | .setPlatform(Platform.all())//设置推送平台为全部平台 |
| | | .setAudience(Audience.alias(tags))//通过别名的方式发送(用户owner_id,员工user_id) |
| | | .setNotification(Notification.alert(content)) |
| | | .build(); |
| | | } |
| | | |
| | | |
| | | private PushPayload buildPushObject_all_all_alert(String title, String content, Map<String, String> map, String...tags) { |
| | | return PushPayload.newBuilder() |
| | | .setPlatform(Platform.all())//设置推送平台为全部平台 |
| | | .setAudience(Audience.alias(tags))//通过别名的方式发送(用户owner_id,员工user_id) |
| | | .setNotification(Notification.android(content, title, map)) |
| | | .setNotification(Notification.ios(content, map)) |
| | | .setNotification(Notification.winphone(content, map)) |
| | | .build(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 推送 |
| | | * @param tags |
| | | * @param content |
| | | */ |
| | | public void push(Integer type, String content, String...tags){ |
| | | String masterSecret = (type == 1 ? masterSecretDriver : masterSecretDispatch); |
| | | String appKey = (type == 1 ? appKeyDriver : appKeyDispatch); |
| | | JPushClient jpushClient = new JPushClient(masterSecret, appKey, null, ClientConfig.getInstance()); |
| | | PushPayload payload = this.buildPushObject_all_all_alert(content, tags); |
| | | try { |
| | | PushResult result = jpushClient.sendPush(payload); |
| | | System.err.println(result.statusCode); |
| | | } catch (APIConnectionException e) { |
| | | e.printStackTrace(); |
| | | } catch (APIRequestException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | public void push(Integer type, String content, String title, Map<String, String> map, String...tags){ |
| | | String masterSecret = (type == 1 ? masterSecretDriver : masterSecretDispatch); |
| | | String appKey = (type == 1 ? appKeyDriver : appKeyDispatch); |
| | | JPushClient jpushClient = new JPushClient(masterSecret, appKey, null, ClientConfig.getInstance()); |
| | | PushPayload payload = this.buildPushObject_all_all_alert(title, content, map, tags); |
| | | try { |
| | | PushResult result = jpushClient.sendPush(payload); |
| | | System.err.println(result.statusCode); |
| | | } catch (APIConnectionException e) { |
| | | e.printStackTrace(); |
| | | } catch (APIRequestException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 聚合数据工具类 |
| | | */ |
| | | @Component |
| | | public class JuHeUtil { |
| | | |
| | | @Value("${juhe.appKey}") |
| | | private String key; |
| | | |
| | | @Autowired |
| | | private HttpClientUtil httpClientUtil; |
| | | |
| | | /** |
| | | * 身份证号码实名认证 |
| | | * @param name |
| | | * @param idcard |
| | | * @return |
| | | */ |
| | | public boolean idcard(String name, String idcard){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("key", key); |
| | | map.put("idcard", idcard); |
| | | map.put("realname", name); |
| | | String content = httpClientUtil.pushHttpRequset("GET", "http://op.juhe.cn/idcard/query", map, new HashMap<>(), "form"); |
| | | System.err.println(content); |
| | | JSONObject jsonObject = JSON.parseObject(content); |
| | | if(jsonObject.getIntValue("error_code") == 0){ |
| | | int res = jsonObject.getJSONObject("result").getIntValue("res"); |
| | | return res == 1 ? true : false; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据银行卡号获取银行数据 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public Map<String, String> queryBank(String code){ |
| | | String url = "http://apis.juhe.cn/interbank/query?key=" + key + "&bankcard=" + code; |
| | | String get = httpClientUtil.pushHttpRequset("GET", url, null, null, "form"); |
| | | JSONObject jsonObject = JSON.parseObject(get); |
| | | Map<String, String> map = new HashMap<>(); |
| | | if(jsonObject.getIntValue("error_code") == 0){ |
| | | JSONObject result = jsonObject.getJSONObject("result"); |
| | | JSONObject data = result.getJSONObject("data"); |
| | | JSONObject record = data.getJSONArray("record").getJSONObject(0); |
| | | |
| | | String province = record.getString("province"); |
| | | String city = record.getString("city"); |
| | | String district = record.getString("district"); |
| | | String address = record.getString("addr"); |
| | | map.put("msg", "success"); |
| | | map.put("address", province + city + district); |
| | | map.put("bank_name", record.getString("lname")); |
| | | map.put("bank", record.getString("bank")); |
| | | map.put("bank_code", record.getString("bankcode"));//联行号 |
| | | }else{ |
| | | map.put("msg", jsonObject.getString("reason")); |
| | | } |
| | | return map; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util; |
| | | |
| | | import java.security.MessageDigest; |
| | | |
| | | public class MD5AndKL { |
| | | |
| | | /** |
| | | * MD5加码。32位 |
| | | * |
| | | * @param inStr |
| | | * @return |
| | | */ |
| | | public static String MD5(String inStr) { |
| | | MessageDigest md5 = null; |
| | | try { |
| | | md5 = MessageDigest.getInstance("MD5"); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e.toString()); |
| | | } |
| | | byte[] md5Bytes = md5.digest(inStr.getBytes()); |
| | | StringBuffer hexValue = new StringBuffer(); |
| | | for (int i = 0; i < md5Bytes.length; i++) { |
| | | int val = ((int) md5Bytes[i]) & 0xff; |
| | | if (val < 16) { |
| | | hexValue.append("0"); |
| | | } |
| | | hexValue.append(Integer.toHexString(val)); |
| | | } |
| | | return hexValue.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 可逆的加密算法 |
| | | * |
| | | * @param inStr |
| | | * @return |
| | | */ |
| | | public static String KL(String inStr) { |
| | | char[] a = inStr.toCharArray(); |
| | | for (int i = 0; i < a.length; i++) { |
| | | a[i] = (char) (a[i] ^ 't'); |
| | | } |
| | | String s = new String(a); |
| | | return s; |
| | | } |
| | | |
| | | /** |
| | | * 加密后解密 |
| | | * |
| | | * @param inStr |
| | | * @return |
| | | */ |
| | | public static String JM(String inStr) { |
| | | char[] a = inStr.toCharArray(); |
| | | for (int i = 0; i < a.length; i++) { |
| | | a[i] = (char) (a[i] ^ 't'); |
| | | } |
| | | String k = new String(a); |
| | | return k; |
| | | } |
| | | |
| | | |
| | | |
| | | private static String byteArrayToHexString(byte b[]) { |
| | | StringBuffer resultSb = new StringBuffer(); |
| | | for (int i = 0; i < b.length; i++) |
| | | resultSb.append(byteToHexString(b[i])); |
| | | |
| | | return resultSb.toString(); |
| | | } |
| | | |
| | | private static String byteToHexString(byte b) { |
| | | int n = b; |
| | | if (n < 0) |
| | | n += 256; |
| | | int d1 = n / 16; |
| | | int d2 = n % 16; |
| | | return hexDigits[d1] + hexDigits[d2]; |
| | | } |
| | | |
| | | public static String MD5Encode(String origin, String charsetname) { |
| | | String resultString = null; |
| | | try { |
| | | resultString = new String(origin); |
| | | MessageDigest md = MessageDigest.getInstance("MD5"); |
| | | if (charsetname == null || "".equals(charsetname)){ |
| | | resultString = byteArrayToHexString(md.digest(resultString.getBytes())); |
| | | }else{ |
| | | resultString = byteArrayToHexString(md.digest(resultString.getBytes(charsetname))); |
| | | } |
| | | } catch (Exception exception) { |
| | | exception.printStackTrace(); |
| | | } |
| | | return resultString; |
| | | } |
| | | |
| | | private static final String hexDigits[] = { "0", "1", "2", "3", "4", "5", |
| | | "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" }; |
| | | |
| | | public static void main(String args[]) { |
| | | |
| | | System.out.println("MD5后再加密:" + KL(MD5("123456"))); |
| | | System.out.println(MD5("123456")); |
| | | // System.out.println("加密:" + KL(MD5("123456"))); |
| | | // s = KL(s); |
| | | // System.out.println("解密:" + KL("81dc9bdb52d04dc20036dbd8313ed055")); |
| | | // System.out.println("解密:" + JM(KL(s))); |
| | | // System.out.println("解密为MD5后的:" + KL(KL(MD5(s)))); |
| | | // System.out.println(JM("5d62957bb57d3e49dcf48a0df064be4c")); |
| | | // System.out.println(MD5AndKL.KL(MD5AndKL.MD5("admin"+"87654321"))); |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.api.AlipayApiException; |
| | | import com.alipay.api.AlipayClient; |
| | | import com.alipay.api.DefaultAlipayClient; |
| | | import com.alipay.api.domain.AlipayTradeAppPayModel; |
| | | import com.alipay.api.internal.util.AlipaySignature; |
| | | import com.alipay.api.request.AlipayTradeAppPayRequest; |
| | | import com.alipay.api.request.AlipayTradePrecreateRequest; |
| | | import com.alipay.api.request.AlipayTradeQueryRequest; |
| | | import com.alipay.api.request.AlipayTradeRefundRequest; |
| | | import com.alipay.api.response.AlipayTradeAppPayResponse; |
| | | import com.alipay.api.response.AlipayTradePrecreateResponse; |
| | | import com.alipay.api.response.AlipayTradeQueryResponse; |
| | | import com.alipay.api.response.AlipayTradeRefundResponse; |
| | | import org.apache.commons.collections.map.HashedMap; |
| | | import org.bouncycastle.jce.provider.BouncyCastleProvider; |
| | | import org.dom4j.Document; |
| | | import org.dom4j.DocumentException; |
| | | import org.dom4j.Element; |
| | | import org.dom4j.io.SAXReader; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.crypto.BadPaddingException; |
| | | import javax.crypto.Cipher; |
| | | import javax.crypto.IllegalBlockSizeException; |
| | | import javax.crypto.NoSuchPaddingException; |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.net.InetAddress; |
| | | import java.net.UnknownHostException; |
| | | import java.security.InvalidKeyException; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.security.NoSuchProviderException; |
| | | import java.security.Security; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 第三方支付工具类 |
| | | */ |
| | | @Component |
| | | public class PayMoneyUtil { |
| | | |
| | | @Value("${alipay.appid}") |
| | | private String aliAppid;//支付宝appid |
| | | |
| | | @Value("${alipay.appPrivateKey}") |
| | | private String appPrivateKey;//支付宝开发者应用私钥 |
| | | |
| | | @Value("${alipay.alipayPublicKey}") |
| | | private String alipayPublicKey;//支付宝应用公钥 |
| | | |
| | | @Value("${alipay.alipay_public_key}") |
| | | private String alipay_public_key;//支付宝支付公钥 |
| | | |
| | | @Value("${wx.appid}") |
| | | private String appid;//微信appid |
| | | |
| | | @Value("${wx.mchId}") |
| | | private String mchId;//微信商户号 |
| | | |
| | | @Value("${wx.key}") |
| | | private String key;//微信商户号 |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath;//支付回调网关地址 |
| | | |
| | | @Autowired |
| | | private HttpClientUtil httpClientUtil; |
| | | |
| | | private Map<String, JSONObject> order = new HashMap<>();//存储支付订单用于主动查询支付结果 |
| | | |
| | | |
| | | /** |
| | | * 支付宝支付 |
| | | */ |
| | | public ResultUtil alipay(String body, String subject, String outTradeNo, String amount, String notifyUrl){ |
| | | //实例化客户端 |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipayPublicKey, "RSA2"); |
| | | //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest(); |
| | | //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | AlipayTradeAppPayModel model = new AlipayTradeAppPayModel(); |
| | | model.setBody(body);//对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。 |
| | | model.setSubject(subject);//商品的标题/交易标题/订单标题/订单关键字等。 |
| | | model.setOutTradeNo(outTradeNo);//商户网站唯一订单号 |
| | | model.setTimeoutExpress("30m"); |
| | | model.setTotalAmount(amount);//付款金额 |
| | | model.setProductCode("QUICK_MSECURITY_PAY"); |
| | | request.setBizModel(model); |
| | | request.setNotifyUrl(callbackPath + notifyUrl); |
| | | try { |
| | | //这里和普通的接口调用不同,使用的是sdkExecute |
| | | AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("orderString", response.getBody()); |
| | | System.out.println(map);//就是orderString 可以直接给客户端请求,无需再做处理。 |
| | | return ResultUtil.success(map); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付宝扫码支付下单 |
| | | * @param body |
| | | * @param subject |
| | | * @param outTradeNo |
| | | * @param amount |
| | | * @param notifyUrl |
| | | * @return |
| | | */ |
| | | public ResultUtil aliScanCodePay(String body, String subject, String outTradeNo, String amount, String notifyUrl){ |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); //获得初始化的AlipayClient |
| | | AlipayTradePrecreateRequest request = new AlipayTradePrecreateRequest();//创建API对应的request类 |
| | | request.setBizContent("{" + |
| | | " \"out_trade_no\":\"" + outTradeNo + "\"," +//商户订单号 |
| | | " \"total_amount\":\"" + 1 + "\"," + |
| | | " \"subject\":\"" + subject + "\"," + |
| | | " \"notify_url\":\"" + callbackPath + notifyUrl + "\"," + |
| | | " \"body\":\"" + body + "\"," + |
| | | " \"store_id\":\"NJ_001\"," + |
| | | " \"timeout_express\":\"90m\"}");//订单允许的最晚付款时间 |
| | | AlipayTradePrecreateResponse response = null; |
| | | try { |
| | | response = alipayClient.execute(request); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | JSONObject alipay_trade_precreate_response = JSON.parseObject(response.getBody()).getJSONObject("alipay_trade_precreate_response"); |
| | | |
| | | System.err.print(alipay_trade_precreate_response.getString("qr_code")); |
| | | return ResultUtil.success(alipay_trade_precreate_response.getString("qr_code")); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付成功后的回调处理逻辑 |
| | | * @param request |
| | | */ |
| | | public Map<String, String> alipayCallback(HttpServletRequest request){ |
| | | //获取支付宝POST过来反馈信息 |
| | | Map<String,String> params = new HashMap<String,String>(); |
| | | Map requestParams = request.getParameterMap(); |
| | | for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext();) { |
| | | String name = (String) iter.next(); |
| | | String[] values = (String[]) requestParams.get(name); |
| | | String valueStr = ""; |
| | | for (int i = 0; i < values.length; i++) { |
| | | valueStr = (i == values.length - 1) ? valueStr + values[i] |
| | | : valueStr + values[i] + ","; |
| | | } |
| | | //乱码解决,这段代码在出现乱码时使用。 |
| | | //valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8"); |
| | | params.put(name, valueStr); |
| | | } |
| | | //切记alipaypublickey是支付宝的公钥,请去open.alipay.com对应应用下查看。 |
| | | //boolean AlipaySignature.rsaCheckV1(Map<String, String> params, String publicKey, String charset, String sign_type) |
| | | try { |
| | | boolean flag = AlipaySignature.rsaCheckV1(params, alipayPublicKey, "UTF-8","RSA2"); |
| | | if(flag){ |
| | | Map<String, String> map = new HashMap<>(); |
| | | String out_trade_no = params.get("out_trade_no"); |
| | | String subject = params.get("subject"); |
| | | String total_amount = params.get("total_amount"); |
| | | String trade_no = params.get("trade_no"); |
| | | map.put("out_trade_no", out_trade_no);//商家订单号 |
| | | map.put("subject", subject); |
| | | map.put("total_amount", total_amount); |
| | | map.put("trade_no", trade_no);//支付宝交易号 |
| | | return map; |
| | | } |
| | | |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付宝查询订单支付状态 |
| | | * @param out_trade_no |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public ResultUtil queryALIOrder(String out_trade_no) throws Exception{ |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do",aliAppid, appPrivateKey,"json","UTF-8", alipay_public_key,"RSA2"); |
| | | AlipayTradeQueryRequest request = new AlipayTradeQueryRequest(); |
| | | request.setBizContent("{" + |
| | | "\"out_trade_no\":" + out_trade_no + |
| | | " }"); |
| | | AlipayTradeQueryResponse response = alipayClient.execute(request); |
| | | if(response.isSuccess()){ |
| | | String tradeStatus = response.getTradeStatus();//交易状态:WAIT_BUYER_PAY(交易创建,等待买家付款)、TRADE_CLOSED(未付款交易超时关闭,或支付完成后全额退款)、TRADE_SUCCESS(交易支付成功)、TRADE_FINISHED(交易结束,不可退款) |
| | | return ResultUtil.success(tradeStatus); |
| | | } else { |
| | | return ResultUtil.error(response.getMsg()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 微信统一下单 |
| | | * @param body 商品描述 |
| | | * @param attach 附加数据 |
| | | * @param out_trade_no 商户订单号 |
| | | * @param total_fee 标价金额 |
| | | * @param notify_url 通知地址 |
| | | * @param tradeType 交易类型 |
| | | * @return |
| | | */ |
| | | public ResultUtil weixinpay(String body, String attach, String out_trade_no, String total_fee, String notify_url, String tradeType) throws Exception{ |
| | | int i = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); |
| | | String hostAddress = null; |
| | | try { |
| | | hostAddress = InetAddress.getLocalHost().getHostAddress(); |
| | | } catch (UnknownHostException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String nonce_str = UUIDUtil.getRandomCode(16); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("appid", appid); |
| | | map.put("mch_id", mchId); |
| | | map.put("nonce_str", nonce_str); |
| | | map.put("body", body); |
| | | map.put("attach", attach);//存储订单id |
| | | map.put("out_trade_no", out_trade_no);//存储的订单code |
| | | map.put("total_fee", i); |
| | | map.put("spbill_create_ip", hostAddress); |
| | | map.put("notify_url", callbackPath + notify_url); |
| | | map.put("trade_type", tradeType); |
| | | String s = this.weixinSignature(map); |
| | | map.put("sign", s); |
| | | |
| | | String url = "https://api.mch.weixin.qq.com/pay/unifiedorder"; |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for(int l = 0; l < keys.length; l++){ |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = httpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[",""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | if("SUCCESS".equals(return_code)){ |
| | | String result_code = map1.get("result_code"); |
| | | if("SUCCESS".equals(result_code)){ |
| | | String type = map1.get("trade_type"); |
| | | switch (type){ |
| | | case "JSAPI": |
| | | break; |
| | | case "NATIVE": |
| | | String code_url = map1.get("code_url"); |
| | | return ResultUtil.success(code_url); |
| | | case "APP": |
| | | String prepay_id = map1.get("prepay_id"); |
| | | //重新进行签名后返回给前端 |
| | | Map<String, Object> map2 = new HashMap<>(); |
| | | map2.put("appid", appid); |
| | | map2.put("noncestr", nonce_str); |
| | | map2.put("package", "Sign=WXPay"); |
| | | map2.put("partnerid", mchId); |
| | | map2.put("prepayid", prepay_id); |
| | | map2.put("timestamp", new Date().getTime() / 1000); |
| | | String s1 = this.weixinSignature(map2); |
| | | map2.put("sign", s1); |
| | | System.err.println(map2); |
| | | return ResultUtil.success(map2); |
| | | } |
| | | return null; |
| | | }else{ |
| | | System.err.println(map1.get("err_code_des")); |
| | | return ResultUtil.error(map1.get("err_code_des")); |
| | | } |
| | | }else{ |
| | | System.err.println(map1.get("return_msg") + appid + "----" + mchId); |
| | | return ResultUtil.error(map1.get("return_msg"), new JSONObject()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 微信支付成功后的回调处理 |
| | | * @param request |
| | | */ |
| | | public Map<String, String> weixinpayCallback(HttpServletRequest request){ |
| | | try { |
| | | String param = this.getParam(request); |
| | | param = param.replaceAll("<!\\[CDATA\\[",""); |
| | | param = param.replaceAll("]]>", ""); |
| | | Map<String, String> map = this.xmlToMap(param, "UTF-8"); |
| | | String return_code = map.get("return_code"); |
| | | if("SUCCESS".equals(return_code)){ |
| | | String result_code = map.get("result_code"); |
| | | if("SUCCESS".equals(result_code)){ |
| | | Map<String, String> map1 = new HashedMap(); |
| | | map1.put("nonce_str", map.get("nonce_str")); |
| | | map1.put("out_trade_no", map.get("out_trade_no").split("_")[1]);//存储的订单code |
| | | map1.put("attach", map.get("attach"));//存储订单id |
| | | map1.put("total_fee", map.get("total_fee")); |
| | | map1.put("transaction_id", map.get("transaction_id"));//微信支付订单号 |
| | | String result = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>"; |
| | | map1.put("result", result); |
| | | return map1; |
| | | }else{ |
| | | // System.err.println(map.get("err_code_des")); |
| | | } |
| | | }else{ |
| | | // System.err.println(map.get("return_msg")); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信扫码收款 |
| | | * @param body 商品描述 |
| | | * @param attach 附加数据 |
| | | * @param nonce_str 随机字符串 |
| | | * @param out_trade_no 商户订单号 |
| | | * @param total_fee 订单金额 |
| | | * @param auth_code 授权码 扫码支付授权码,设备读取用户微信中的条码或者二维码信息(注:用户付款码条形码规则:18位纯数字,以10、11、12、13、14、15开头) |
| | | * @return |
| | | */ |
| | | public ResultUtil wxScanQRCodePay(String body, String attach, String nonce_str, String out_trade_no, String total_fee, String auth_code){ |
| | | int i = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); |
| | | String hostAddress = null; |
| | | try { |
| | | InetAddress address = InetAddress.getLocalHost(); |
| | | hostAddress = address.getHostAddress(); |
| | | } catch (UnknownHostException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String randomCode = null; |
| | | try { |
| | | randomCode = UUIDUtil.getRandomCode(10); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("appid", appid); |
| | | map.put("mch_id", mchId); |
| | | map.put("nonce_str", nonce_str);//存储的支付人员id,员工扫描二维码支付的时候存储的是收款员工id |
| | | map.put("body", body); |
| | | map.put("attach", attach);//存储的费用月份数据,员工扫描二维码支付的时候存储的是收费项id |
| | | map.put("out_trade_no", randomCode + "_" + out_trade_no);//存储的房间id |
| | | map.put("total_fee", i); |
| | | map.put("spbill_create_ip", hostAddress); |
| | | map.put("auth_code", auth_code); |
| | | String s = this.weixinSignature(map); |
| | | map.put("sign", s); |
| | | |
| | | String url = "https://api.mch.weixin.qq.com/pay/unifiedorder"; |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for(int l = 0; l < keys.length; l++){ |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = httpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[",""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | if("SUCCESS".equals(return_code)){ |
| | | String result_code = map1.get("result_code"); |
| | | if("SUCCESS".equals(result_code)){ |
| | | String type = map1.get("trade_type"); |
| | | switch (type){ |
| | | case "JSAPI": |
| | | break; |
| | | case "NATIVE": |
| | | String code_url = map1.get("code_url"); |
| | | return ResultUtil.success(code_url); |
| | | case "APP": |
| | | String prepay_id = map1.get("prepay_id"); |
| | | //重新进行签名后返回给前端 |
| | | Map<String, Object> map2 = new HashMap<>(); |
| | | map2.put("appid", appid); |
| | | map2.put("noncestr", nonce_str); |
| | | map2.put("package", "Sign=WXPay"); |
| | | map2.put("partnerid", mchId); |
| | | map2.put("prepayid", prepay_id); |
| | | map2.put("timestamp", new Date().getTime() + ""); |
| | | String s1 = this.weixinSignature(map2); |
| | | |
| | | map2.put("pac", "Sign=WXPay"); |
| | | map2.put("sign", s1); |
| | | // System.err.println(map2); |
| | | return ResultUtil.success(map2); |
| | | } |
| | | return null; |
| | | }else{ |
| | | // System.err.println(map1.get("err_code_des")); |
| | | return ResultUtil.error(map1.get("err_code_des")); |
| | | } |
| | | }else{ |
| | | // System.err.println(map1.get("return_msg") + appid + "----" + mchId); |
| | | return ResultUtil.error(map1.get("return_msg"), new JSONObject()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付宝扫码收款 |
| | | * @param data |
| | | * @return |
| | | */ |
| | | public Object aliScanQRCodePay(String data){ |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信退款申请 |
| | | * @param transaction_id 微信订单号。微信生成的订单号,在支付通知中有返回 |
| | | * @param out_refund_no 商户退款单号。商户系统内部的退款单号,商户系统内部唯一,只能是数字、大小写字母_-|*@ ,同一退款单号多次请求只退一笔。 |
| | | * @param total_fee 订单金额。订单总金额,单位为分,只能为整数 |
| | | * @param refund_fee 退款金额。退款总金额,订单总金额,单位为分,只能为整数 |
| | | * @param notify_url 退款结果通知url。异步接收微信支付退款结果通知的回调地址,通知URL必须为外网可访问的url,不允许带参数 如果参数中传了notify_url,则商户平台上配置的回调地址将不会生效。 |
| | | * @return |
| | | */ |
| | | public Map<String, String> wxRefund(String transaction_id, String out_refund_no, String total_fee, String refund_fee, String notify_url){ |
| | | int tf = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); |
| | | int rf = new BigDecimal(refund_fee).multiply(new BigDecimal("100")).intValue(); |
| | | String nonce_str = UUIDUtil.getRandomCode(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("appid", appid); |
| | | map.put("mch_id", mchId); |
| | | map.put("nonce_str", nonce_str); |
| | | map.put("transaction_id", transaction_id); |
| | | map.put("out_refund_no", out_refund_no); |
| | | map.put("total_fee", tf); |
| | | map.put("refund_fee", rf); |
| | | map.put("notify_url", callbackPath + notify_url); |
| | | String s = this.weixinSignature(map); |
| | | map.put("sign", s); |
| | | |
| | | String url = "https://api.mch.weixin.qq.com/secapi/pay/refund"; |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for(int l = 0; l < keys.length; l++){ |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = httpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[",""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | Map<String, String> map2 = new HashMap<>(); |
| | | if("SUCCESS".equals(return_code)){ |
| | | String result_code = map1.get("result_code"); |
| | | if("SUCCESS".equals(result_code)){ |
| | | map2.put("return_code", result_code); |
| | | map2.put("refund_id", String.valueOf(map1.get("refund_id")));//微信退款订单号 |
| | | map2.put("refund_fee", String.valueOf(map1.get("refund_fee")));//退款金额 |
| | | return map2; |
| | | }else{ |
| | | map2.put("return_code", result_code); |
| | | map2.put("return_msg", map1.get("err_code_des")); |
| | | return map2; |
| | | } |
| | | }else{ |
| | | map2.put("return_code", return_code); |
| | | map2.put("return_msg", map1.get("return_msg")); |
| | | return map2; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信退款成功后的回调处理 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public Map<String, String> wxRefundCallback(HttpServletRequest request){ |
| | | try { |
| | | String param = this.getParam(request); |
| | | param = param.replaceAll("<!\\[CDATA\\[",""); |
| | | param = param.replaceAll("]]>", ""); |
| | | Map<String, String> map = this.xmlToMap(param, "UTF-8"); |
| | | String return_code = map.get("return_code"); |
| | | if("SUCCESS".equals(return_code)){ |
| | | String req_info = map.get("req_info");//加密信息请用商户秘钥进行解密 |
| | | String s = this.wxDecrypt(req_info); |
| | | s = s.replaceAll("<!\\[CDATA\\[",""); |
| | | s = s.replaceAll("]]>", ""); |
| | | map = this.xmlToMap(s, "UTF-8"); |
| | | Map<String, String> map1 = new HashMap<>(); |
| | | map1.put("refund_id", map.get("refund_id")); |
| | | map1.put("out_refund_no", map.get("out_refund_no")); |
| | | return map1; |
| | | }else{ |
| | | // System.err.println(map.get("return_msg")); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvalidKeyException e) { |
| | | e.printStackTrace(); |
| | | } catch (NoSuchPaddingException e) { |
| | | e.printStackTrace(); |
| | | } catch (BadPaddingException e) { |
| | | e.printStackTrace(); |
| | | } catch (NoSuchProviderException e) { |
| | | e.printStackTrace(); |
| | | } catch (IllegalBlockSizeException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付宝退款 |
| | | * @param trade_no 支付宝交易号 |
| | | * @param refund_amount 退款金额 |
| | | * @return |
| | | * @throws AlipayApiException |
| | | */ |
| | | public Map<String, String> aliRefund(String trade_no, String refund_amount) throws AlipayApiException { |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey,"json","UTF-8", alipay_public_key,"RSA2"); |
| | | AlipayTradeRefundRequest request = new AlipayTradeRefundRequest(); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("trade_no", trade_no); |
| | | jsonObject.put("refund_amount", refund_amount); |
| | | request.setBizContent(jsonObject.toJSONString()); |
| | | AlipayTradeRefundResponse response = alipayClient.execute(request); |
| | | Map<String, String> map = new HashMap<>(); |
| | | if(response.isSuccess()){ |
| | | System.out.println("调用成功"); |
| | | String outTradeNo = response.getOutTradeNo(); |
| | | map.put("code", response.getCode());//10000 |
| | | map.put("trade_no", response.getTradeNo());//支付宝交易号 |
| | | map.put("out_trade_no", outTradeNo);//商户订单号 |
| | | } else { |
| | | System.out.println("调用失败"); |
| | | map.put("code", response.getCode()); |
| | | map.put("msg", response.getSubMsg()); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询微信支付订单 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public ResultUtil queryWXOrder() throws Exception{ |
| | | String url = "https://api.mch.weixin.qq.com/pay/orderquery"; |
| | | String nonce_str = UUIDUtil.getRandomCode(16); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("appid", appid); |
| | | map.put("mch_id", mchId); |
| | | map.put("transaction_id", nonce_str);//微信订单号 |
| | | map.put("nonce_str", nonce_str);//随机字符串 |
| | | String s = this.weixinSignature(map); |
| | | map.put("sign", s); |
| | | |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for(int l = 0; l < keys.length; l++){ |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = httpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[",""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | if("SUCCESS".equals(return_code)){ |
| | | String result_code = map1.get("result_code"); |
| | | if("SUCCESS".equals(result_code)){ |
| | | String type = map1.get("trade_type"); |
| | | switch (type){ |
| | | case "JSAPI": |
| | | break; |
| | | case "NATIVE": |
| | | String code_url = map1.get("code_url"); |
| | | return ResultUtil.success(code_url); |
| | | case "APP": |
| | | String trade_state = map1.get("trade_state"); |
| | | String time_end = map1.get("time_end"); |
| | | Map<String, Object> map2 = new HashMap<>(); |
| | | map2.put("trade_state", trade_state);//订单状态SUCCESS—支付成功,REFUND—转入退款,NOTPAY—未支付,CLOSED—已关闭,REVOKED—已撤销(刷卡支付),USERPAYING--用户支付中,PAYERROR--支付失败(其他原因,如银行返回失败) |
| | | map2.put("time_end", time_end);//订单支付时间,格式为yyyyMMddHHmmss,如2009年12月25日9点10分10秒表示为20091225091010。 |
| | | return ResultUtil.success(map2); |
| | | } |
| | | return null; |
| | | }else{ |
| | | System.err.println(map1.get("err_code_des")); |
| | | return ResultUtil.error(map1.get("err_code_des")); |
| | | } |
| | | }else{ |
| | | System.err.println(map1.get("return_msg") + appid + "----" + mchId); |
| | | return ResultUtil.error(map1.get("return_msg"), new JSONObject()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取请求内容 |
| | | * @param request |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | private String getParam(HttpServletRequest request) throws IOException { |
| | | // 读取参数 |
| | | InputStream inputStream; |
| | | StringBuilder sb = new StringBuilder(); |
| | | inputStream = request.getInputStream(); |
| | | String s; |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); |
| | | while ((s = in.readLine()) != null) { |
| | | sb.append(s); |
| | | } |
| | | in.close(); |
| | | inputStream.close(); |
| | | return sb.toString(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信下单的签名算法 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | private String weixinSignature(Map<String, Object> map){ |
| | | try { |
| | | Set<Map.Entry<String, Object>> entries = map.entrySet(); |
| | | List<Map.Entry<String, Object>> infoIds = new ArrayList<Map.Entry<String, Object>>(entries); |
| | | // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序) |
| | | Collections.sort(infoIds, new Comparator<Map.Entry<String, Object>>() { |
| | | public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2) { |
| | | return (o1.getKey()).toString().compareTo(o2.getKey()); |
| | | } |
| | | }); |
| | | // 构造签名键值对的格式 |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (Map.Entry<String, Object> item : infoIds) { |
| | | if (item.getKey() != null || item.getKey() != "") { |
| | | String key = item.getKey(); |
| | | Object val = item.getValue(); |
| | | if (!(val == "" || val == null)) { |
| | | sb.append(key + "=" + val + "&"); |
| | | } |
| | | } |
| | | } |
| | | sb.append("key=" + key); |
| | | String sign = MD5AndKL.MD5Encode(sb.toString(), "UTF-8").toUpperCase(); //注:MD5签名方式 |
| | | return sign; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信退款成功后的解密 |
| | | * @param req_info |
| | | * @return |
| | | */ |
| | | private String wxDecrypt(String req_info) throws NoSuchPaddingException, NoSuchAlgorithmException, NoSuchProviderException, |
| | | InvalidKeyException, BadPaddingException, IllegalBlockSizeException { |
| | | byte[] decode = Base64.getDecoder().decode(req_info); |
| | | String sign = MD5AndKL.MD5Encode(key, "UTF-8").toLowerCase(); |
| | | if (Security.getProvider("BC") == null){ |
| | | Security.addProvider(new BouncyCastleProvider()); |
| | | } |
| | | Cipher cipher = Cipher.getInstance("AES/ECB/PKCS7Padding", "BC"); |
| | | SecretKeySpec secretKeySpec = new SecretKeySpec(sign.getBytes(), "AES"); |
| | | cipher.init(Cipher.DECRYPT_MODE, secretKeySpec); |
| | | return new String(cipher.doFinal(decode)); |
| | | } |
| | | |
| | | |
| | | public static void main(String[] ages){ |
| | | // PayMoneyUtil payMoneyUtil = new PayMoneyUtil(); |
| | | // payMoneyUtil.weixinpay("测试", "123", "12.5", ""); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * xml转map |
| | | * @param xml |
| | | * @param charset |
| | | * @return |
| | | * @throws UnsupportedEncodingException |
| | | * @throws DocumentException |
| | | */ |
| | | public static Map<String, String> xmlToMap(String xml, String charset) throws UnsupportedEncodingException, DocumentException { |
| | | |
| | | Map<String, String> respMap = new HashMap<String, String>(); |
| | | |
| | | SAXReader reader = new SAXReader(); |
| | | Document doc = reader.read(new ByteArrayInputStream(xml.getBytes(charset))); |
| | | Element root = doc.getRootElement(); |
| | | xmlToMap(root, respMap); |
| | | return respMap; |
| | | } |
| | | |
| | | public static Map<String, String> xmlToMap(Element tmpElement, Map<String, String> respMap){ |
| | | if (tmpElement.isTextOnly()) { |
| | | respMap.put(tmpElement.getName(), tmpElement.getText()); |
| | | return respMap; |
| | | } |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | Iterator<Element> eItor = tmpElement.elementIterator(); |
| | | while (eItor.hasNext()) { |
| | | Element element = eItor.next(); |
| | | xmlToMap(element, respMap); |
| | | } |
| | | return respMap; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.LinkedMultiValueMap; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | |
| | | /** |
| | | * Redis工具类 |
| | | */ |
| | | @Component |
| | | public class RedisUtil { |
| | | |
| | | @Autowired |
| | | private RestTemplate internalRestTemplate; |
| | | |
| | | |
| | | /** |
| | | * 向redis中存储字符串没有过期时间 |
| | | * @param key |
| | | * @param value |
| | | */ |
| | | public void setStrValue(String key, String value){ |
| | | if(ToolUtil.isNotEmpty(key)){ |
| | | //发送验证码短信 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("key", key); |
| | | params.add("value", value); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/redis/setValue_", requestEntity, String.class); |
| | | JSONObject jsonObject = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject.getIntValue("code") != 200){ |
| | | System.err.println("调用redis出错了"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 以分钟为单位设置存储值(设置过期时间) |
| | | * @param key |
| | | * @param value |
| | | * @param time 秒 |
| | | */ |
| | | public void setStrValue(String key, String value, int time){ |
| | | if(ToolUtil.isNotEmpty(key)){ |
| | | //发送验证码短信 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, String> params = new LinkedMultiValueMap<>(); |
| | | params.add("key", key); |
| | | params.add("value", value); |
| | | params.add("time", String.valueOf(time)); |
| | | HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/redis/setValue", requestEntity, String.class); |
| | | JSONObject jsonObject = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject.getIntValue("code") != 200){ |
| | | System.err.println("调用redis出错了"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 从redis中获取值 |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public String getValue(String key){ |
| | | if(ToolUtil.isNotEmpty(key)){ |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("key", key); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/redis/getValue",requestEntity , String.class); |
| | | JSONObject jsonObject = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject.getIntValue("code") != 200){ |
| | | System.err.println("调用redis出错了"); |
| | | } |
| | | return jsonObject.getString("data"); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 删除key |
| | | * @param key |
| | | */ |
| | | public String remove(String key){ |
| | | if(ToolUtil.isNotEmpty(key)){ |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("key", key); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/redis/remove",requestEntity , String.class); |
| | | JSONObject jsonObject = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject.getIntValue("code") != 200){ |
| | | System.err.println("调用redis出错了"); |
| | | } |
| | | return jsonObject.getString("data"); |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | /** |
| | | * 定义统一返回对象 |
| | | */ |
| | | @ApiModel(value = "统一返回结果集") |
| | | public class ResultUtil<T> { |
| | | |
| | | public static final Integer SUCCESS = 200; |
| | | |
| | | public static final Integer PARAM_ERROR = 300; |
| | | |
| | | public static final Integer RUNTIME_ERROR = 400; |
| | | |
| | | public static final Integer ERROR = 500; |
| | | |
| | | public static final Integer TOKEN_ERROR = 600; |
| | | |
| | | public static final Integer SIGN_ERROR = 700; |
| | | |
| | | public static final String Token = "TOKEN_INVALID"; |
| | | |
| | | public static final String SIGN = "SIGN_INVALID"; |
| | | |
| | | @ApiModelProperty(name = "code", value = "业务状态码 200:成功,300:参数错误,400:运行异常,500:其他异常, 600:token无效,需重新登录,700:签名无效") |
| | | private Integer code;//备用状态码 |
| | | |
| | | @ApiModelProperty(name = "msg", value = "返回结果说明") |
| | | private String msg;//返回说明 |
| | | |
| | | @ApiModelProperty(name = "data", value = "返回结果值") |
| | | private T data;//返回数据 |
| | | |
| | | |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public T getData() { |
| | | return data; |
| | | } |
| | | |
| | | |
| | | public Integer getCode() { |
| | | return code; |
| | | } |
| | | |
| | | private ResultUtil(Integer code, String msg) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | private ResultUtil(Integer code, String msg, T data) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | this.data = data; |
| | | } |
| | | |
| | | |
| | | public static <T> ResultUtil<T> getResult(Integer code, String msg){ |
| | | return new ResultUtil<>(code, msg); |
| | | } |
| | | |
| | | public static <T> ResultUtil<T> getResult(Integer code, String msg, T data){ |
| | | return new ResultUtil<>(code, msg, data); |
| | | } |
| | | |
| | | /** |
| | | * 错误信息 |
| | | * @return |
| | | */ |
| | | public static ResultUtil error(String mag){ |
| | | return ResultUtil.getResult(ResultUtil.ERROR, mag, new JSONObject()); |
| | | } |
| | | |
| | | /** |
| | | * 错误信息 |
| | | * @return |
| | | */ |
| | | public static <T> ResultUtil<T> error(String mag, T obj){ |
| | | return ResultUtil.getResult(ResultUtil.ERROR, mag, obj); |
| | | } |
| | | |
| | | /** |
| | | * token失效 |
| | | * @return |
| | | */ |
| | | public static ResultUtil tokenErr(){ |
| | | return ResultUtil.getResult(ResultUtil.TOKEN_ERROR, ResultUtil.Token, new JSONObject()); |
| | | } |
| | | |
| | | /** |
| | | * token失效 |
| | | * @return |
| | | */ |
| | | public static ResultUtil tokenErr(String msg){ |
| | | return ResultUtil.getResult(ResultUtil.TOKEN_ERROR, msg, new JSONObject()); |
| | | } |
| | | |
| | | /** |
| | | * 参数异常 |
| | | * @return |
| | | */ |
| | | public static ResultUtil paranErr(){ |
| | | return ResultUtil.getResult(ResultUtil.PARAM_ERROR, "PARAM_ERROR", new JSONObject()); |
| | | } |
| | | |
| | | /** |
| | | * 参数异常 |
| | | * @return |
| | | */ |
| | | public static <T> ResultUtil<T> paranErr(T data){ |
| | | return ResultUtil.getResult(ResultUtil.PARAM_ERROR, "SYSTEM_RUN_ERROR", data); |
| | | } |
| | | |
| | | /** |
| | | * 运行异常 |
| | | * @return |
| | | */ |
| | | public static ResultUtil runErr(){ |
| | | return ResultUtil.getResult(ResultUtil.RUNTIME_ERROR, "SYSTEM_RUN_ERROR", new JSONObject()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 运行异常 |
| | | * @return |
| | | */ |
| | | public static <T> ResultUtil<T> runErr(T data){ |
| | | return ResultUtil.getResult(ResultUtil.RUNTIME_ERROR, "SYSTEM_RUN_ERROR", data); |
| | | } |
| | | |
| | | /** |
| | | * 运行异常 |
| | | * @return |
| | | */ |
| | | public static <T> ResultUtil<T> runErr(T data, String msg){ |
| | | return ResultUtil.getResult(ResultUtil.RUNTIME_ERROR, msg, data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 返回成功 |
| | | * @param |
| | | * @return |
| | | */ |
| | | public static ResultUtil success(){ |
| | | return ResultUtil.getResult(ResultUtil.SUCCESS, "SUCCESS", new JSONObject()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 返回成功 |
| | | * @param data |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | public static <T> ResultUtil<T> success(T data){ |
| | | return ResultUtil.getResult(ResultUtil.SUCCESS, "SUCCESS", data); |
| | | } |
| | | |
| | | /** |
| | | * 返回成功 |
| | | * @param msg |
| | | * @param data |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | public static <T> ResultUtil<T> success(String msg, T data){ |
| | | return ResultUtil.getResult(ResultUtil.SUCCESS, msg, data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 签名无效 |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | public static <T> ResultUtil<T> sign(){ |
| | | return ResultUtil.getResult(ResultUtil.SIGN_ERROR, SIGN); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util; |
| | | |
| | | public class SystemException extends Exception { |
| | | private String msg; |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public void setMsg(String msg) { |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public SystemException(String msg){ |
| | | super(msg); |
| | | this.setMsg(msg); |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util; |
| | | |
| | | |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * 定义生成随机码的工具类 |
| | | */ |
| | | public class UUIDUtil { |
| | | |
| | | private int i = 1; |
| | | |
| | | |
| | | /** |
| | | * 定义生成原生的UUID随机码 |
| | | * @return |
| | | */ |
| | | public static String getNativeUUID(){ |
| | | return UUID.randomUUID().toString(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 生成32位随机码 |
| | | * @return |
| | | */ |
| | | public static String getRandomCode(){ |
| | | return UUIDUtil.getNativeUUID().replaceAll("-", ""); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取给定长度的随机码 |
| | | * @param num |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String getRandomCode(Integer num) throws Exception{ |
| | | String str = null; |
| | | if(0 < num){ |
| | | if(num % 32 > 0){ |
| | | Integer s = num / 32; |
| | | Integer l = num % 32; |
| | | StringBuffer sb = new StringBuffer(); |
| | | for(int i = 0; i < s; i++){ |
| | | sb.append(UUIDUtil.getRandomCode()); |
| | | } |
| | | sb.append(UUIDUtil.getRandomCode().substring(0, l)); |
| | | str = sb.toString(); |
| | | }else if(num % 32 == 0){ |
| | | Integer s = num / 32; |
| | | StringBuffer sb = new StringBuffer(); |
| | | for(int i = 0; i < s; i++){ |
| | | sb.append(UUIDUtil.getRandomCode()); |
| | | } |
| | | str = sb.toString(); |
| | | }else{ |
| | | str = UUIDUtil.getRandomCode().substring(0, num); |
| | | } |
| | | }else{ |
| | | throw new Exception("参数只能大于0"); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取根据当前时间的字符串数据 |
| | | * @return |
| | | */ |
| | | public synchronized static String getTimeStr(){ |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmssS"); |
| | | return simpleDateFormat.format(new Date()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | @ApiModel("活动") |
| | | public class ActivityWarpper { |
| | | @ApiModelProperty("活动id") |
| | | private Integer id; |
| | | @ApiModelProperty("活动描述") |
| | | private String content; |
| | | @ApiModelProperty("完成情况") |
| | | private String carryOut; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(String content) { |
| | | this.content = content; |
| | | } |
| | | |
| | | public String getCarryOut() { |
| | | return carryOut; |
| | | } |
| | | |
| | | public void setCarryOut(String carryOut) { |
| | | this.carryOut = carryOut; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 公共封装类 |
| | | */ |
| | | @ApiModel("公共对象") |
| | | public class BaseWarpper { |
| | | @ApiModelProperty("主键id") |
| | | private Integer id; |
| | | @ApiModelProperty("名称") |
| | | private String name; |
| | | @ApiModelProperty("内容") |
| | | private String content; |
| | | @ApiModelProperty("数量") |
| | | private Integer number; |
| | | @ApiModelProperty("金额") |
| | | private Double amount; |
| | | @ApiModelProperty("时长(分钟)") |
| | | private Integer minute; |
| | | @ApiModelProperty("经度") |
| | | private Double lon; |
| | | @ApiModelProperty("纬度") |
| | | private Double lat; |
| | | @ApiModelProperty("日期") |
| | | private String day; |
| | | @ApiModelProperty("其他内容") |
| | | private Object data; |
| | | |
| | | public BaseWarpper() { |
| | | this.id = 0; |
| | | this.name = ""; |
| | | this.content = ""; |
| | | this.number = 0; |
| | | this.amount = 0D; |
| | | this.minute = 0; |
| | | this.lon = 0D; |
| | | this.lat = 0D; |
| | | this.day = ""; |
| | | } |
| | | |
| | | 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 getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(String content) { |
| | | this.content = content; |
| | | } |
| | | |
| | | public Integer getNumber() { |
| | | return number; |
| | | } |
| | | |
| | | public void setNumber(Integer number) { |
| | | this.number = number; |
| | | } |
| | | |
| | | public Double getAmount() { |
| | | return amount; |
| | | } |
| | | |
| | | public void setAmount(Double amount) { |
| | | this.amount = amount; |
| | | } |
| | | |
| | | public Integer getMinute() { |
| | | return minute; |
| | | } |
| | | |
| | | public void setMinute(Integer minute) { |
| | | this.minute = minute; |
| | | } |
| | | |
| | | public Double getLon() { |
| | | return lon; |
| | | } |
| | | |
| | | public void setLon(Double lon) { |
| | | this.lon = lon; |
| | | } |
| | | |
| | | public Double getLat() { |
| | | return lat; |
| | | } |
| | | |
| | | public void setLat(Double lat) { |
| | | this.lat = lat; |
| | | } |
| | | |
| | | public String getDay() { |
| | | return day; |
| | | } |
| | | |
| | | public void setDay(String day) { |
| | | this.day = day; |
| | | } |
| | | |
| | | public Object getData() { |
| | | return data; |
| | | } |
| | | |
| | | public void setData(Object data) { |
| | | this.data = data; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "BaseWarpper{" + |
| | | "id=" + id + |
| | | ", name='" + name + '\'' + |
| | | ", content='" + content + '\'' + |
| | | ", number=" + number + |
| | | ", amount=" + amount + |
| | | ", minute=" + minute + |
| | | ", lon=" + lon + |
| | | ", lat=" + lat + |
| | | ", day='" + day + '\'' + |
| | | ", data=" + data + |
| | | '}'; |
| | | } |
| | | |
| | | public static BaseWarpper getBaseWarpper(Map<String, Object> map){ |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | if(null != map){ |
| | | baseWarpper.setId(null != map.get("id") ? Integer.valueOf(map.get("id").toString()) : 0); |
| | | baseWarpper.setName(null != map.get("name") ? map.get("name").toString() : ""); |
| | | baseWarpper.setContent(null != map.get("content") ? map.get("content").toString() : ""); |
| | | baseWarpper.setNumber(null != map.get("number") ? Integer.valueOf(map.get("number").toString()) : 0); |
| | | baseWarpper.setAmount(null != map.get("amount") ? Double.valueOf(map.get("amount").toString()) : 0); |
| | | baseWarpper.setMinute(null != map.get("minute") ? Integer.valueOf(map.get("minute").toString()) : 0); |
| | | baseWarpper.setLon(null != map.get("lon") ? Double.valueOf(map.get("lon").toString()) : 0.0); |
| | | baseWarpper.setLat(null != map.get("lat") ? Double.valueOf(map.get("lat").toString()) : 0.0); |
| | | baseWarpper.setDay(null != map.get("day") ? map.get("day").toString() : ""); |
| | | baseWarpper.setData(null != map.get("data") ? map.get("data") : new Object()); |
| | | } |
| | | return baseWarpper; |
| | | } |
| | | |
| | | |
| | | public static List<BaseWarpper> getBaseWarppers(List<Map<String, Object>> list){ |
| | | List<BaseWarpper> data = new ArrayList<>(); |
| | | if(null != list){ |
| | | for(Map<String, Object> map : list){ |
| | | data.add(BaseWarpper.getBaseWarpper(map)); |
| | | } |
| | | } |
| | | return data; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import com.supersavedriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.supersavedriving.user.core.base.warpper.BaseControllerWarpper; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 部门列表的包装 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017年4月25日 18:10:31 |
| | | */ |
| | | public class DeptWarpper extends BaseControllerWarpper { |
| | | |
| | | public DeptWarpper(Object list) { |
| | | super(list); |
| | | } |
| | | |
| | | @Override |
| | | public void warpTheMap(Map<String, Object> map) { |
| | | |
| | | Integer pid = (Integer) map.get("pid"); |
| | | |
| | | if (ToolUtil.isEmpty(pid) || pid.equals(0)) { |
| | | map.put("pName", "--"); |
| | | } else { |
| | | map.put("pName", ConstantFactory.me().getDeptName(pid)); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import com.supersavedriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.supersavedriving.user.modular.system.model.Dict; |
| | | import com.supersavedriving.user.core.base.warpper.BaseControllerWarpper; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 字典列表的包装 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017年4月25日 18:10:31 |
| | | */ |
| | | public class DictWarpper extends BaseControllerWarpper { |
| | | |
| | | public DictWarpper(Object list) { |
| | | super(list); |
| | | } |
| | | |
| | | @Override |
| | | public void warpTheMap(Map<String, Object> map) { |
| | | StringBuffer detail = new StringBuffer(); |
| | | Integer id = Integer.valueOf(map.get("id").toString()); |
| | | List<Dict> dicts = ConstantFactory.me().findInDict(id); |
| | | if(dicts != null){ |
| | | for (Dict dict : dicts) { |
| | | detail.append(dict.getCode() + ":" +dict.getName() + ","); |
| | | } |
| | | map.put("detail", ToolUtil.removeSuffix(detail.toString(),",")); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @ApiModel("个人中心详情") |
| | | public class DriverInfoWarpper { |
| | | @ApiModelProperty("司机id(用于生成二维码)") |
| | | private Integer id; |
| | | @ApiModelProperty("头像") |
| | | private String avatar; |
| | | @ApiModelProperty("姓名") |
| | | private String name; |
| | | @ApiModelProperty("电话") |
| | | private String phone; |
| | | @ApiModelProperty("性别") |
| | | private Integer sex; |
| | | @ApiModelProperty("车牌") |
| | | private String licensePlate; |
| | | @ApiModelProperty("车辆品牌") |
| | | private String brand; |
| | | @ApiModelProperty("车辆颜色") |
| | | private String carColor; |
| | | @ApiModelProperty("历史接单数") |
| | | private Integer orderNum; |
| | | @ApiModelProperty("评分") |
| | | private Double score; |
| | | @ApiModelProperty("账户余额") |
| | | private Double balance; |
| | | @ApiModelProperty("活动总收入") |
| | | private Double activityMoney; |
| | | @ApiModelProperty("剩余可提现活动收入") |
| | | private Double laveActivityMoney; |
| | | @ApiModelProperty("历史总收入") |
| | | private Double businessMoney; |
| | | @ApiModelProperty("剩余可提现收入") |
| | | private Double laveBusinessMoney; |
| | | @ApiModelProperty("出租车资格证号") |
| | | private String taxiAptitudeCard; |
| | | @ApiModelProperty("发证日期") |
| | | private String networkCarlssueDate; |
| | | @ApiModelProperty("公司") |
| | | private String company; |
| | | @ApiModelProperty("居住地(带分隔符)") |
| | | private String driverContactAddress_; |
| | | @ApiModelProperty("身份证号码") |
| | | private String idCard; |
| | | @ApiModelProperty("身份证正面照") |
| | | private String idCardImgUrl1; |
| | | @ApiModelProperty("身份证背面照") |
| | | private String idCardImgUrl2; |
| | | @ApiModelProperty("初次领取驾驶证日期") |
| | | private String getDriverLicenseDate; |
| | | @ApiModelProperty("服务模式(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车)多个以逗号分隔") |
| | | private String type; |
| | | @ApiModelProperty("从业地(带分隔符)") |
| | | private String placeOfPractice; |
| | | @ApiModelProperty("从业地行政区域代码") |
| | | private String placeOfEmployment; |
| | | @ApiModelProperty("驾驶证照片") |
| | | private String driveCardImgUrl; |
| | | @ApiModelProperty("网约车资格证照片") |
| | | private String networkCarlssueImg; |
| | | |
| | | 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 getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Integer getSex() { |
| | | return sex; |
| | | } |
| | | |
| | | public void setSex(Integer sex) { |
| | | this.sex = sex; |
| | | } |
| | | |
| | | public String getLicensePlate() { |
| | | return licensePlate; |
| | | } |
| | | |
| | | public void setLicensePlate(String licensePlate) { |
| | | this.licensePlate = licensePlate; |
| | | } |
| | | |
| | | public String getBrand() { |
| | | return brand; |
| | | } |
| | | |
| | | public void setBrand(String brand) { |
| | | this.brand = brand; |
| | | } |
| | | |
| | | public String getCarColor() { |
| | | return carColor; |
| | | } |
| | | |
| | | public void setCarColor(String carColor) { |
| | | this.carColor = carColor; |
| | | } |
| | | |
| | | public Integer getOrderNum() { |
| | | return orderNum; |
| | | } |
| | | |
| | | public void setOrderNum(Integer orderNum) { |
| | | this.orderNum = orderNum; |
| | | } |
| | | |
| | | public Double getScore() { |
| | | return score; |
| | | } |
| | | |
| | | public void setScore(Double score) { |
| | | this.score = score; |
| | | } |
| | | |
| | | public Double getBalance() { |
| | | return balance; |
| | | } |
| | | |
| | | public void setBalance(Double balance) { |
| | | this.balance = balance; |
| | | } |
| | | |
| | | public String getPhone() { |
| | | return phone; |
| | | } |
| | | |
| | | public void setPhone(String phone) { |
| | | this.phone = phone; |
| | | } |
| | | |
| | | public Double getActivityMoney() { |
| | | return activityMoney; |
| | | } |
| | | |
| | | public void setActivityMoney(Double activityMoney) { |
| | | this.activityMoney = activityMoney; |
| | | } |
| | | |
| | | public Double getBusinessMoney() { |
| | | return businessMoney; |
| | | } |
| | | |
| | | public void setBusinessMoney(Double businessMoney) { |
| | | this.businessMoney = businessMoney; |
| | | } |
| | | |
| | | public String getTaxiAptitudeCard() { |
| | | return taxiAptitudeCard; |
| | | } |
| | | |
| | | public void setTaxiAptitudeCard(String taxiAptitudeCard) { |
| | | this.taxiAptitudeCard = taxiAptitudeCard; |
| | | } |
| | | |
| | | public String getNetworkCarlssueDate() { |
| | | return networkCarlssueDate; |
| | | } |
| | | |
| | | public void setNetworkCarlssueDate(String networkCarlssueDate) { |
| | | this.networkCarlssueDate = networkCarlssueDate; |
| | | } |
| | | |
| | | public String getCompany() { |
| | | return company; |
| | | } |
| | | |
| | | public void setCompany(String company) { |
| | | this.company = company; |
| | | } |
| | | |
| | | public String getDriverContactAddress_() { |
| | | return driverContactAddress_; |
| | | } |
| | | |
| | | public void setDriverContactAddress_(String driverContactAddress_) { |
| | | this.driverContactAddress_ = driverContactAddress_; |
| | | } |
| | | |
| | | public String getIdCard() { |
| | | return idCard; |
| | | } |
| | | |
| | | public void setIdCard(String idCard) { |
| | | this.idCard = idCard; |
| | | } |
| | | |
| | | public String getIdCardImgUrl1() { |
| | | return idCardImgUrl1; |
| | | } |
| | | |
| | | public void setIdCardImgUrl1(String idCardImgUrl1) { |
| | | this.idCardImgUrl1 = idCardImgUrl1; |
| | | } |
| | | |
| | | public String getIdCardImgUrl2() { |
| | | return idCardImgUrl2; |
| | | } |
| | | |
| | | public void setIdCardImgUrl2(String idCardImgUrl2) { |
| | | this.idCardImgUrl2 = idCardImgUrl2; |
| | | } |
| | | |
| | | public String getGetDriverLicenseDate() { |
| | | return getDriverLicenseDate; |
| | | } |
| | | |
| | | public void setGetDriverLicenseDate(String getDriverLicenseDate) { |
| | | this.getDriverLicenseDate = getDriverLicenseDate; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getPlaceOfPractice() { |
| | | return placeOfPractice; |
| | | } |
| | | |
| | | public void setPlaceOfPractice(String placeOfPractice) { |
| | | this.placeOfPractice = placeOfPractice; |
| | | } |
| | | |
| | | public String getDriveCardImgUrl() { |
| | | return driveCardImgUrl; |
| | | } |
| | | |
| | | public void setDriveCardImgUrl(String driveCardImgUrl) { |
| | | this.driveCardImgUrl = driveCardImgUrl; |
| | | } |
| | | |
| | | public String getNetworkCarlssueImg() { |
| | | return networkCarlssueImg; |
| | | } |
| | | |
| | | public void setNetworkCarlssueImg(String networkCarlssueImg) { |
| | | this.networkCarlssueImg = networkCarlssueImg; |
| | | } |
| | | |
| | | public String getPlaceOfEmployment() { |
| | | return placeOfEmployment; |
| | | } |
| | | |
| | | public void setPlaceOfEmployment(String placeOfEmployment) { |
| | | this.placeOfEmployment = placeOfEmployment; |
| | | } |
| | | |
| | | public Double getLaveActivityMoney() { |
| | | return laveActivityMoney; |
| | | } |
| | | |
| | | public void setLaveActivityMoney(Double laveActivityMoney) { |
| | | this.laveActivityMoney = laveActivityMoney; |
| | | } |
| | | |
| | | public Double getLaveBusinessMoney() { |
| | | return laveBusinessMoney; |
| | | } |
| | | |
| | | public void setLaveBusinessMoney(Double laveBusinessMoney) { |
| | | this.laveBusinessMoney = laveBusinessMoney; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "DriverInfoWarpper{" + |
| | | "id=" + id + |
| | | ", avatar='" + avatar + '\'' + |
| | | ", name='" + name + '\'' + |
| | | ", phone='" + phone + '\'' + |
| | | ", sex=" + sex + |
| | | ", licensePlate='" + licensePlate + '\'' + |
| | | ", brand='" + brand + '\'' + |
| | | ", carColor='" + carColor + '\'' + |
| | | ", orderNum=" + orderNum + |
| | | ", score=" + score + |
| | | ", balance=" + balance + |
| | | ", activityMoney=" + activityMoney + |
| | | ", laveActivityMoney=" + laveActivityMoney + |
| | | ", businessMoney=" + businessMoney + |
| | | ", laveBusinessMoney=" + laveBusinessMoney + |
| | | ", taxiAptitudeCard='" + taxiAptitudeCard + '\'' + |
| | | ", networkCarlssueDate='" + networkCarlssueDate + '\'' + |
| | | ", company='" + company + '\'' + |
| | | ", driverContactAddress_='" + driverContactAddress_ + '\'' + |
| | | ", idCard='" + idCard + '\'' + |
| | | ", idCardImgUrl1='" + idCardImgUrl1 + '\'' + |
| | | ", idCardImgUrl2='" + idCardImgUrl2 + '\'' + |
| | | ", getDriverLicenseDate='" + getDriverLicenseDate + '\'' + |
| | | ", type='" + type + '\'' + |
| | | ", placeOfPractice='" + placeOfPractice + '\'' + |
| | | ", placeOfEmployment='" + placeOfEmployment + '\'' + |
| | | ", driveCardImgUrl='" + driveCardImgUrl + '\'' + |
| | | ", networkCarlssueImg='" + networkCarlssueImg + '\'' + |
| | | '}'; |
| | | } |
| | | |
| | | public static DriverInfoWarpper getDriverInfoWarpper(Map<String, Object> map){ |
| | | DriverInfoWarpper driverInfoWarpper = new DriverInfoWarpper(); |
| | | if(null != map){ |
| | | driverInfoWarpper.setId(null != map.get("id") ? Integer.valueOf(String.valueOf(map.get("id"))) : 0); |
| | | driverInfoWarpper.setAvatar(null != map.get("avatar") ? String.valueOf(map.get("avatar")) : ""); |
| | | driverInfoWarpper.setName(null != map.get("name") ? String.valueOf(map.get("name")) : ""); |
| | | driverInfoWarpper.setPhone(null != map.get("phone") ? String.valueOf(map.get("phone")) : ""); |
| | | driverInfoWarpper.setSex(null != map.get("sex") ? Integer.valueOf(String.valueOf(map.get("sex"))) : 0); |
| | | driverInfoWarpper.setLicensePlate(null != map.get("licensePlate") ? String.valueOf(map.get("licensePlate")) : ""); |
| | | driverInfoWarpper.setBrand(null != map.get("brand") ? String.valueOf(map.get("brand")) : ""); |
| | | driverInfoWarpper.setCarColor(null != map.get("carColor") ? String.valueOf(map.get("carColor")) : ""); |
| | | driverInfoWarpper.setOrderNum(null != map.get("orderNum") ? Integer.valueOf(String.valueOf(map.get("orderNum"))) : 0); |
| | | driverInfoWarpper.setScore(null != map.get("score") ? Double.valueOf(String.valueOf(map.get("score"))) : 0); |
| | | driverInfoWarpper.setBalance(null != map.get("balance") ? Double.valueOf(String.valueOf(map.get("balance"))) : 0); |
| | | driverInfoWarpper.setActivityMoney(null != map.get("activityMoney") ? Double.valueOf(String.valueOf(map.get("activityMoney"))) : 0); |
| | | driverInfoWarpper.setBusinessMoney(null != map.get("businessMoney") ? Double.valueOf(String.valueOf(map.get("businessMoney"))) : 0); |
| | | driverInfoWarpper.setTaxiAptitudeCard(null != map.get("taxiAptitudeCard") ? String.valueOf(map.get("taxiAptitudeCard")) : ""); |
| | | driverInfoWarpper.setNetworkCarlssueDate(null != map.get("networkCarlssueDate") ? String.valueOf(map.get("networkCarlssueDate")) : ""); |
| | | driverInfoWarpper.setCompany(null != map.get("company") ? String.valueOf(map.get("company")) : ""); |
| | | driverInfoWarpper.setDriverContactAddress_(null != map.get("driverContactAddress_") ? String.valueOf(map.get("driverContactAddress_")) : ""); |
| | | driverInfoWarpper.setIdCard(null != map.get("idCard") ? String.valueOf(map.get("idCard")) : ""); |
| | | driverInfoWarpper.setIdCardImgUrl1(null != map.get("idCardImgUrl1") ? String.valueOf(map.get("idCardImgUrl1")) : ""); |
| | | driverInfoWarpper.setIdCardImgUrl2(null != map.get("idCardImgUrl2") ? String.valueOf(map.get("idCardImgUrl2")) : ""); |
| | | driverInfoWarpper.setGetDriverLicenseDate(null != map.get("getDriverLicenseDate") ? String.valueOf(map.get("getDriverLicenseDate")) : ""); |
| | | driverInfoWarpper.setType(null != map.get("type") ? String.valueOf(map.get("type")) : ""); |
| | | driverInfoWarpper.setPlaceOfPractice(null != map.get("placeOfPractice") ? String.valueOf(map.get("placeOfPractice")) : ""); |
| | | driverInfoWarpper.setDriveCardImgUrl(null != map.get("driveCardImgUrl") ? String.valueOf(map.get("driveCardImgUrl")) : ""); |
| | | driverInfoWarpper.setNetworkCarlssueImg(null != map.get("networkCarlssueImg") ? String.valueOf(map.get("networkCarlssueImg")) : ""); |
| | | driverInfoWarpper.setPlaceOfEmployment(null != map.get("placeOfEmployment") ? String.valueOf(map.get("placeOfEmployment")) : ""); |
| | | driverInfoWarpper.setLaveActivityMoney(null != map.get("laveActivityMoney") ? Double.valueOf(String.valueOf(map.get("laveActivityMoney"))) : 0); |
| | | driverInfoWarpper.setLaveBusinessMoney(null != map.get("laveBusinessMoney") ? Double.valueOf(String.valueOf(map.get("laveBusinessMoney"))) : 0); |
| | | } |
| | | return driverInfoWarpper; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @ApiModel("首页统计") |
| | | public class HomeWarpper { |
| | | @ApiModelProperty("车牌号") |
| | | private String licensePlate; |
| | | @ApiModelProperty("车辆品牌") |
| | | private String brand; |
| | | @ApiModelProperty("今日接单") |
| | | private Integer dayNum; |
| | | @ApiModelProperty("月接单") |
| | | private Integer mouthNum; |
| | | @ApiModelProperty("评分") |
| | | private Double score; |
| | | @ApiModelProperty("活动数") |
| | | private Integer activity; |
| | | @ApiModelProperty("上下班状态(1=上班,2=下班)") |
| | | private Integer work; |
| | | |
| | | public String getLicensePlate() { |
| | | return licensePlate; |
| | | } |
| | | |
| | | public void setLicensePlate(String licensePlate) { |
| | | this.licensePlate = licensePlate; |
| | | } |
| | | |
| | | public String getBand() { |
| | | return brand; |
| | | } |
| | | |
| | | public void setBand(String brand) { |
| | | this.brand = brand; |
| | | } |
| | | |
| | | public Integer getDayNum() { |
| | | return dayNum; |
| | | } |
| | | |
| | | public void setDayNum(Integer dayNum) { |
| | | this.dayNum = dayNum; |
| | | } |
| | | |
| | | public Integer getMouthNum() { |
| | | return mouthNum; |
| | | } |
| | | |
| | | public void setMouthNum(Integer mouthNum) { |
| | | this.mouthNum = mouthNum; |
| | | } |
| | | |
| | | public Double getScore() { |
| | | return score; |
| | | } |
| | | |
| | | public void setScore(Double score) { |
| | | this.score = score; |
| | | } |
| | | |
| | | public Integer getActivity() { |
| | | return activity; |
| | | } |
| | | |
| | | public void setActivity(Integer activity) { |
| | | this.activity = activity; |
| | | } |
| | | |
| | | public String getBrand() { |
| | | return brand; |
| | | } |
| | | |
| | | public void setBrand(String brand) { |
| | | this.brand = brand; |
| | | } |
| | | |
| | | public Integer getWork() { |
| | | return work; |
| | | } |
| | | |
| | | public void setWork(Integer work) { |
| | | this.work = work; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "HomeWarpper{" + |
| | | "licensePlate='" + licensePlate + '\'' + |
| | | ", brand='" + brand + '\'' + |
| | | ", dayNum=" + dayNum + |
| | | ", mouthNum=" + mouthNum + |
| | | ", score=" + score + |
| | | ", activity=" + activity + |
| | | ", work=" + work + |
| | | '}'; |
| | | } |
| | | |
| | | public static HomeWarpper getHomeWarpper(Map<String, Object> map){ |
| | | HomeWarpper homeWarpper = new HomeWarpper(); |
| | | if(null != map){ |
| | | homeWarpper.setLicensePlate(null != map.get("licensePlate") ? String.valueOf(map.get("licensePlate")) : ""); |
| | | homeWarpper.setBand(null != map.get("brand") ? String.valueOf(map.get("brand")) : ""); |
| | | homeWarpper.setDayNum(null != map.get("dayNum") ? Integer.valueOf(String.valueOf(map.get("dayNum"))) : 0); |
| | | homeWarpper.setMouthNum(null != map.get("mouthNum") ? Integer.valueOf(String.valueOf(map.get("mouthNum"))) : 0); |
| | | homeWarpper.setScore(null != map.get("score") ? Double.valueOf(String.valueOf(map.get("score"))) : 0); |
| | | homeWarpper.setActivity(null != map.get("activity") ? Integer.valueOf(String.valueOf(map.get("activity"))) : 0); |
| | | homeWarpper.setWork(null != map.get("work") ? Integer.valueOf(String.valueOf(map.get("work"))) : 0); |
| | | } |
| | | return homeWarpper; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import com.supersavedriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.supersavedriving.user.core.base.warpper.BaseControllerWarpper; |
| | | import com.supersavedriving.user.core.util.Contrast; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 日志列表的包装类 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017年4月5日22:56:24 |
| | | */ |
| | | public class LogWarpper extends BaseControllerWarpper { |
| | | |
| | | public LogWarpper(Object list) { |
| | | super(list); |
| | | } |
| | | |
| | | @Override |
| | | public void warpTheMap(Map<String, Object> map) { |
| | | String message = (String) map.get("message"); |
| | | |
| | | Integer userid = (Integer) map.get("userid"); |
| | | map.put("userName", ConstantFactory.me().getUserNameById(userid)); |
| | | |
| | | //如果信息过长,则只截取前100位字符串 |
| | | if (ToolUtil.isNotEmpty(message) && message.length() >= 100) { |
| | | String subMessage = message.substring(0, 100) + "..."; |
| | | map.put("message", subMessage); |
| | | } |
| | | |
| | | //如果信息中包含分割符号;;; 则分割字符串返给前台 |
| | | if (ToolUtil.isNotEmpty(message) && message.indexOf(Contrast.separator) != -1) { |
| | | String[] msgs = message.split(Contrast.separator); |
| | | map.put("regularMessage",msgs); |
| | | }else{ |
| | | map.put("regularMessage",message); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | @ApiModel("登录") |
| | | public class LoginWarpper { |
| | | @ApiModelProperty("用户id") |
| | | private Integer id; |
| | | @ApiModelProperty("token") |
| | | private String token; |
| | | @ApiModelProperty("appid") |
| | | private String appid; |
| | | @ApiModelProperty("高德猎鹰服务id") |
| | | private String serverId; |
| | | @ApiModelProperty("高德猎鹰终端id") |
| | | private String terminalId; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getToken() { |
| | | return token; |
| | | } |
| | | |
| | | public void setToken(String token) { |
| | | this.token = token; |
| | | } |
| | | |
| | | public String getAppid() { |
| | | return appid; |
| | | } |
| | | |
| | | public void setAppid(String appid) { |
| | | this.appid = appid; |
| | | } |
| | | |
| | | public String getServerId() { |
| | | return serverId; |
| | | } |
| | | |
| | | public void setServerId(String serverId) { |
| | | this.serverId = serverId; |
| | | } |
| | | |
| | | public String getTerminalId() { |
| | | return terminalId; |
| | | } |
| | | |
| | | public void setTerminalId(String terminalId) { |
| | | this.terminalId = terminalId; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import com.supersavedriving.user.core.base.warpper.BaseControllerWarpper; |
| | | import com.supersavedriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.supersavedriving.user.core.constant.IsMenu; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 菜单列表的包装类 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017年2月19日15:07:29 |
| | | */ |
| | | public class MenuWarpper extends BaseControllerWarpper { |
| | | |
| | | public MenuWarpper(List<Map<String, Object>> list) { |
| | | super(list); |
| | | } |
| | | |
| | | @Override |
| | | public void warpTheMap(Map<String, Object> map) { |
| | | map.put("statusName", ConstantFactory.me().getMenuStatusName((Integer) map.get("status"))); |
| | | map.put("isMenuName", IsMenu.valueOf((Integer) map.get("ismenu"))); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 费用明细 |
| | | */ |
| | | @ApiModel("费用明细") |
| | | public class MoneyInfoWarpper { |
| | | @ApiModelProperty("订单总金额") |
| | | private Double orderMoney; |
| | | @ApiModelProperty("起步里程") |
| | | private Double startMileage; |
| | | @ApiModelProperty("起步价") |
| | | private Double startMoney; |
| | | @ApiModelProperty("里程费") |
| | | private Double mileageMoney; |
| | | @ApiModelProperty("里程数") |
| | | private Double mileage; |
| | | @ApiModelProperty("时长费") |
| | | private Double durationMoney; |
| | | @ApiModelProperty("时长") |
| | | private Double duration; |
| | | @ApiModelProperty("等待费") |
| | | private Double waitMoney; |
| | | @ApiModelProperty("等待时长") |
| | | private Double wait; |
| | | @ApiModelProperty("远途费") |
| | | private Double longDistanceMoney; |
| | | @ApiModelProperty("远途里程") |
| | | private Double longDistance; |
| | | @ApiModelProperty("停车费") |
| | | private Double parkMoney; |
| | | @ApiModelProperty("过路费") |
| | | private Double roadTollMoney; |
| | | @ApiModelProperty("红包抵扣金额") |
| | | private Double redPacketMoney; |
| | | @ApiModelProperty("优惠券抵扣金额") |
| | | private Double couponMoney; |
| | | @ApiModelProperty("折扣抵扣金额") |
| | | private Double discountMoney; |
| | | @ApiModelProperty("折扣") |
| | | private Double discount; |
| | | |
| | | public Double getOrderMoney() { |
| | | return orderMoney; |
| | | } |
| | | |
| | | public void setOrderMoney(Double orderMoney) { |
| | | this.orderMoney = orderMoney; |
| | | } |
| | | |
| | | public Double getStartMoney() { |
| | | return startMoney; |
| | | } |
| | | |
| | | public void setStartMoney(Double startMoney) { |
| | | this.startMoney = startMoney; |
| | | } |
| | | |
| | | public Double getMileageMoney() { |
| | | return mileageMoney; |
| | | } |
| | | |
| | | public void setMileageMoney(Double mileageMoney) { |
| | | this.mileageMoney = mileageMoney; |
| | | } |
| | | |
| | | public Double getDurationMoney() { |
| | | return durationMoney; |
| | | } |
| | | |
| | | public void setDurationMoney(Double durationMoney) { |
| | | this.durationMoney = durationMoney; |
| | | } |
| | | |
| | | public Double getWaitMoney() { |
| | | return waitMoney; |
| | | } |
| | | |
| | | public void setWaitMoney(Double waitMoney) { |
| | | this.waitMoney = waitMoney; |
| | | } |
| | | |
| | | public Double getLongDistanceMoney() { |
| | | return longDistanceMoney; |
| | | } |
| | | |
| | | public void setLongDistanceMoney(Double longDistanceMoney) { |
| | | this.longDistanceMoney = longDistanceMoney; |
| | | } |
| | | |
| | | public Double getParkMoney() { |
| | | return parkMoney; |
| | | } |
| | | |
| | | public void setParkMoney(Double parkMoney) { |
| | | this.parkMoney = parkMoney; |
| | | } |
| | | |
| | | public Double getRoadTollMoney() { |
| | | return roadTollMoney; |
| | | } |
| | | |
| | | public void setRoadTollMoney(Double roadTollMoney) { |
| | | this.roadTollMoney = roadTollMoney; |
| | | } |
| | | |
| | | public Double getRedPacketMoney() { |
| | | return redPacketMoney; |
| | | } |
| | | |
| | | public void setRedPacketMoney(Double redPacketMoney) { |
| | | this.redPacketMoney = redPacketMoney; |
| | | } |
| | | |
| | | public Double getCouponMoney() { |
| | | return couponMoney; |
| | | } |
| | | |
| | | public void setCouponMoney(Double couponMoney) { |
| | | this.couponMoney = couponMoney; |
| | | } |
| | | |
| | | public Double getDiscountMoney() { |
| | | return discountMoney; |
| | | } |
| | | |
| | | public void setDiscountMoney(Double discountMoney) { |
| | | this.discountMoney = discountMoney; |
| | | } |
| | | |
| | | public Double getDiscount() { |
| | | return discount; |
| | | } |
| | | |
| | | public void setDiscount(Double discount) { |
| | | this.discount = discount; |
| | | } |
| | | |
| | | public Double getMileage() { |
| | | return mileage; |
| | | } |
| | | |
| | | public void setMileage(Double mileage) { |
| | | this.mileage = mileage; |
| | | } |
| | | |
| | | public Double getDuration() { |
| | | return duration; |
| | | } |
| | | |
| | | public void setDuration(Double duration) { |
| | | this.duration = duration; |
| | | } |
| | | |
| | | public Double getWait() { |
| | | return wait; |
| | | } |
| | | |
| | | public void setWait(Double wait) { |
| | | this.wait = wait; |
| | | } |
| | | |
| | | public Double getLongDistance() { |
| | | return longDistance; |
| | | } |
| | | |
| | | public void setLongDistance(Double longDistance) { |
| | | this.longDistance = longDistance; |
| | | } |
| | | |
| | | public Double getStartMileage() { |
| | | return startMileage; |
| | | } |
| | | |
| | | public void setStartMileage(Double startMileage) { |
| | | this.startMileage = startMileage; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "MoneyInfoWarpper{" + |
| | | "orderMoney=" + orderMoney + |
| | | ", startMoney=" + startMoney + |
| | | ", mileageMoney=" + mileageMoney + |
| | | ", mileage=" + mileage + |
| | | ", durationMoney=" + durationMoney + |
| | | ", duration=" + duration + |
| | | ", waitMoney=" + waitMoney + |
| | | ", wait=" + wait + |
| | | ", longDistanceMoney=" + longDistanceMoney + |
| | | ", longDistance=" + longDistance + |
| | | ", parkMoney=" + parkMoney + |
| | | ", roadTollMoney=" + roadTollMoney + |
| | | ", redPacketMoney=" + redPacketMoney + |
| | | ", couponMoney=" + couponMoney + |
| | | ", discountMoney=" + discountMoney + |
| | | ", discount=" + discount + |
| | | '}'; |
| | | } |
| | | |
| | | public static MoneyInfoWarpper getMoneyInfoWarpper(Map<String, Object> map){ |
| | | MoneyInfoWarpper moneyInfoWarpper = new MoneyInfoWarpper(); |
| | | if(null != map){ |
| | | moneyInfoWarpper.setOrderMoney(null != map.get("orderMoney") ? Double.valueOf(map.get("orderMoney").toString()) : 0D); |
| | | moneyInfoWarpper.setStartMileage(null != map.get("startMileage") ? Double.valueOf(map.get("startMileage").toString()) : 0D); |
| | | moneyInfoWarpper.setStartMoney(null != map.get("startMoney") ? Double.valueOf(map.get("startMoney").toString()) : 0D); |
| | | moneyInfoWarpper.setMileage(null != map.get("mileageKilometers") ? Double.valueOf(map.get("mileageKilometers").toString()) : 0D); |
| | | moneyInfoWarpper.setMileageMoney(null != map.get("mileageMoney") ? Double.valueOf(map.get("mileageMoney").toString()) : 0D); |
| | | moneyInfoWarpper.setDuration(null != map.get("duration") ? Double.valueOf(map.get("duration").toString()) : 0D); |
| | | moneyInfoWarpper.setDurationMoney(null != map.get("durationMoney") ? Double.valueOf(map.get("durationMoney").toString()) : 0D); |
| | | moneyInfoWarpper.setWait(null != map.get("wait") ? Double.valueOf(map.get("wait").toString()) : 0D); |
| | | moneyInfoWarpper.setWaitMoney(null != map.get("waitMoney") ? Double.valueOf(map.get("waitMoney").toString()) : 0D); |
| | | moneyInfoWarpper.setLongDistance(null != map.get("longDistance") ? Double.valueOf(map.get("longDistance").toString()) : 0D); |
| | | moneyInfoWarpper.setLongDistanceMoney(null != map.get("longDistanceMoney") ? Double.valueOf(map.get("longDistanceMoney").toString()) : 0D); |
| | | moneyInfoWarpper.setParkMoney(null != map.get("parkMoney") ? Double.valueOf(map.get("parkMoney").toString()) : 0D); |
| | | moneyInfoWarpper.setRoadTollMoney(null != map.get("roadTollMoney") ? Double.valueOf(map.get("roadTollMoney").toString()) : 0D); |
| | | moneyInfoWarpper.setRedPacketMoney(null != map.get("redPacketMoney") ? Double.valueOf(map.get("redPacketMoney").toString()) : 0D); |
| | | moneyInfoWarpper.setCouponMoney(null != map.get("couponMoney") ? Double.valueOf(map.get("couponMoney").toString()) : 0D); |
| | | moneyInfoWarpper.setDiscountMoney(null != map.get("discountMoney") ? Double.valueOf(map.get("discountMoney").toString()) : 0D); |
| | | moneyInfoWarpper.setDiscount(null != map.get("discount") ? Double.valueOf(map.get("discount").toString()) : 0D); |
| | | } |
| | | return moneyInfoWarpper; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import com.supersavedriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.supersavedriving.user.core.base.warpper.BaseControllerWarpper; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 部门列表的包装 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017年4月25日 18:10:31 |
| | | */ |
| | | public class NoticeWrapper extends BaseControllerWarpper { |
| | | |
| | | public NoticeWrapper(Object list) { |
| | | super(list); |
| | | } |
| | | |
| | | @Override |
| | | public void warpTheMap(Map<String, Object> map) { |
| | | Integer creater = (Integer) map.get("creater"); |
| | | map.put("createrName", ConstantFactory.me().getUserNameById(creater)); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @ApiModel("评价列表") |
| | | public class OrderEvaluateWarpper { |
| | | @ApiModelProperty("总评分") |
| | | private Double sumScore; |
| | | @ApiModelProperty("历史评价列表") |
| | | private List<JSONObject> list; |
| | | |
| | | public Double getSumScore() { |
| | | return sumScore; |
| | | } |
| | | |
| | | public void setSumScore(Double sumScore) { |
| | | this.sumScore = sumScore; |
| | | } |
| | | |
| | | public List<JSONObject> getList() { |
| | | return list; |
| | | } |
| | | |
| | | public void setList(List<JSONObject> list) { |
| | | this.list = list; |
| | | } |
| | | |
| | | public static OrderEvaluateWarpper getOrderEvaluateWarpper(Map<String, Object> map){ |
| | | OrderEvaluateWarpper orderEvaluateWarpper = new OrderEvaluateWarpper(); |
| | | if(null != map){ |
| | | orderEvaluateWarpper.setSumScore(null != map.get("sumScore") ? Double.valueOf(String.valueOf(map.get("sumScore"))) : 0); |
| | | List<JSONObject> list = JSONArray.parseArray(JSON.toJSONString(map.get("list")), JSONObject.class); |
| | | orderEvaluateWarpper.setList(null != map.get("list") ? list : new ArrayList<>()); |
| | | } |
| | | return orderEvaluateWarpper; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @ApiModel("订单详情") |
| | | public class OrderInfoWarpper { |
| | | @ApiModelProperty("订单id") |
| | | private Integer orderId; |
| | | @ApiModelProperty("1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中)<br/>" + |
| | | "小件物流订单状态(状态(1=待接单,2=待出发,3=待到达预约地点,4=待取货,5=送货中,6=已送达,7=待支付,8=需补差价,9=已取货,10=已取消,11=已支付差价))") |
| | | private Integer orderState; |
| | | @ApiModelProperty("订单名称") |
| | | private String orderName; |
| | | @ApiModelProperty("出行时间") |
| | | private String travelTime; |
| | | @ApiModelProperty("出行时间") |
| | | private String travelTime_; |
| | | @ApiModelProperty("到达预约点时间") |
| | | private String arriveTime; |
| | | @ApiModelProperty("起点") |
| | | private String startAddress; |
| | | @ApiModelProperty("终点") |
| | | private String endAddress; |
| | | @ApiModelProperty("红包") |
| | | private Double tipMoney; |
| | | @ApiModelProperty("司机当前位置到起点距离(公里)") |
| | | private Double startDistance; |
| | | @ApiModelProperty("全程公里数") |
| | | private Double totalDistance; |
| | | @ApiModelProperty("起点经度") |
| | | private String startLon; |
| | | @ApiModelProperty("起点纬度") |
| | | private String startLat; |
| | | @ApiModelProperty("终点经度") |
| | | private String endLon; |
| | | @ApiModelProperty("终点纬度") |
| | | private String endLat; |
| | | @ApiModelProperty("乘客昵称") |
| | | private String nickName; |
| | | @ApiModelProperty("乘客电话") |
| | | private String phone; |
| | | @ApiModelProperty("乘客历史乘车次数") |
| | | private Integer historyNum; |
| | | @ApiModelProperty("订单总金额") |
| | | private Double orderMoney; |
| | | @ApiModelProperty("支付方式(1=OK平台支付(线上支付),2=其他方式支付(线下支付))") |
| | | private Integer payManner; |
| | | @ApiModelProperty("支付金额") |
| | | private Double payMoney; |
| | | @ApiModelProperty("差价金额") |
| | | private Double differenceMoney; |
| | | @ApiModelProperty("是否是改派单(1=否,2=是)") |
| | | private Integer isReassign; |
| | | @ApiModelProperty("高德猎鹰轨迹id(订单开始后需要上传坐标到指定轨迹中)") |
| | | private String trackId; |
| | | @ApiModelProperty("是否是预约单(1=否,2=是)") |
| | | private Integer reservation; |
| | | @ApiModelProperty("订单类型(乘客下单,调度下单,改派,预约)") |
| | | private String type; |
| | | @ApiModelProperty("报警电话") |
| | | private String emergencyCall; |
| | | @ApiModelProperty("取消原因") |
| | | private String cancelReason; |
| | | @ApiModelProperty("取消备注") |
| | | private String cancelRemark; |
| | | @ApiModelProperty("取消支付金额") |
| | | private Double cancelPayMoney; |
| | | @ApiModelProperty("取消方") |
| | | private String cancelUser; |
| | | @ApiModelProperty("能否改派(1=否,2=是)") |
| | | private Integer reassign; |
| | | @ApiModelProperty("备注") |
| | | private String remark; |
| | | @ApiModelProperty("乘车人数") |
| | | private Integer peopleNumber; |
| | | @ApiModelProperty("座位号") |
| | | private String seatNumber; |
| | | @ApiModelProperty("货物类型(1=普通货物,2=贵重货物)") |
| | | private Integer cargoType; |
| | | @ApiModelProperty("是否加急(1=否,2=是)") |
| | | private Integer urgent; |
| | | @ApiModelProperty("下单用户姓名") |
| | | private String userName; |
| | | @ApiModelProperty("订单来源(1:APP下单,2:扫码下单,3:小程序下单,4:司机下单,5:调度下单,6:道行龙城,7:智慧屏)") |
| | | private Integer orderSource; |
| | | |
| | | public Integer getOrderId() { |
| | | return orderId; |
| | | } |
| | | |
| | | public void setOrderId(Integer orderId) { |
| | | this.orderId = orderId; |
| | | } |
| | | |
| | | public Integer getOrderState() { |
| | | return orderState; |
| | | } |
| | | |
| | | public void setOrderState(Integer orderState) { |
| | | this.orderState = orderState; |
| | | } |
| | | |
| | | public String getOrderName() { |
| | | return orderName; |
| | | } |
| | | |
| | | public void setOrderName(String orderName) { |
| | | this.orderName = orderName; |
| | | } |
| | | |
| | | public String getTravelTime() { |
| | | return travelTime; |
| | | } |
| | | |
| | | public void setTravelTime(String travelTime) { |
| | | this.travelTime = travelTime; |
| | | } |
| | | |
| | | public String getStartAddress() { |
| | | return startAddress; |
| | | } |
| | | |
| | | public void setStartAddress(String startAddress) { |
| | | this.startAddress = startAddress; |
| | | } |
| | | |
| | | public String getEndAddress() { |
| | | return endAddress; |
| | | } |
| | | |
| | | public void setEndAddress(String endAddress) { |
| | | this.endAddress = endAddress; |
| | | } |
| | | |
| | | public Double getTipMoney() { |
| | | return tipMoney; |
| | | } |
| | | |
| | | public void setTipMoney(Double tipMoney) { |
| | | this.tipMoney = tipMoney; |
| | | } |
| | | |
| | | public Double getStartDistance() { |
| | | return startDistance; |
| | | } |
| | | |
| | | public void setStartDistance(Double startDistance) { |
| | | this.startDistance = startDistance; |
| | | } |
| | | |
| | | public Double getTotalDistance() { |
| | | return totalDistance; |
| | | } |
| | | |
| | | public void setTotalDistance(Double totalDistance) { |
| | | this.totalDistance = totalDistance; |
| | | } |
| | | |
| | | public String getStartLon() { |
| | | return startLon; |
| | | } |
| | | |
| | | public void setStartLon(String startLon) { |
| | | this.startLon = startLon; |
| | | } |
| | | |
| | | public String getStartLat() { |
| | | return startLat; |
| | | } |
| | | |
| | | public void setStartLat(String startLat) { |
| | | this.startLat = startLat; |
| | | } |
| | | |
| | | public String getEndLon() { |
| | | return endLon; |
| | | } |
| | | |
| | | public void setEndLon(String endLon) { |
| | | this.endLon = endLon; |
| | | } |
| | | |
| | | public String getEndLat() { |
| | | return endLat; |
| | | } |
| | | |
| | | public void setEndLat(String endLat) { |
| | | this.endLat = endLat; |
| | | } |
| | | |
| | | public String getNickName() { |
| | | return nickName; |
| | | } |
| | | |
| | | public void setNickName(String nickName) { |
| | | this.nickName = nickName; |
| | | } |
| | | |
| | | public String getPhone() { |
| | | return phone; |
| | | } |
| | | |
| | | public void setPhone(String phone) { |
| | | this.phone = phone; |
| | | } |
| | | |
| | | public Integer getHistoryNum() { |
| | | return historyNum; |
| | | } |
| | | |
| | | public void setHistoryNum(Integer historyNum) { |
| | | this.historyNum = historyNum; |
| | | } |
| | | |
| | | public Double getOrderMoney() { |
| | | return orderMoney; |
| | | } |
| | | |
| | | public void setOrderMoney(Double orderMoney) { |
| | | this.orderMoney = orderMoney; |
| | | } |
| | | |
| | | public Integer getPayManner() { |
| | | return payManner; |
| | | } |
| | | |
| | | public void setPayManner(Integer payManner) { |
| | | this.payManner = payManner; |
| | | } |
| | | |
| | | public Double getPayMoney() { |
| | | return payMoney; |
| | | } |
| | | |
| | | public void setPayMoney(Double payMoney) { |
| | | this.payMoney = payMoney; |
| | | } |
| | | |
| | | public Integer getIsReassign() { |
| | | return isReassign; |
| | | } |
| | | |
| | | public void setIsReassign(Integer isReassign) { |
| | | this.isReassign = isReassign; |
| | | } |
| | | |
| | | public String getTrackId() { |
| | | return trackId; |
| | | } |
| | | |
| | | public void setTrackId(String trackId) { |
| | | this.trackId = trackId; |
| | | } |
| | | |
| | | public String getArriveTime() { |
| | | return arriveTime; |
| | | } |
| | | |
| | | public void setArriveTime(String arriveTime) { |
| | | this.arriveTime = arriveTime; |
| | | } |
| | | |
| | | public Integer getReservation() { |
| | | return reservation; |
| | | } |
| | | |
| | | public void setReservation(Integer reservation) { |
| | | this.reservation = reservation; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getEmergencyCall() { |
| | | return emergencyCall; |
| | | } |
| | | |
| | | public void setEmergencyCall(String emergencyCall) { |
| | | this.emergencyCall = emergencyCall; |
| | | } |
| | | |
| | | public String getTravelTime_() { |
| | | return travelTime_; |
| | | } |
| | | |
| | | public void setTravelTime_(String travelTime_) { |
| | | this.travelTime_ = travelTime_; |
| | | } |
| | | |
| | | public String getCancelReason() { |
| | | return cancelReason; |
| | | } |
| | | |
| | | public void setCancelReason(String cancelReason) { |
| | | this.cancelReason = cancelReason; |
| | | } |
| | | |
| | | public String getCancelRemark() { |
| | | return cancelRemark; |
| | | } |
| | | |
| | | public void setCancelRemark(String cancelRemark) { |
| | | this.cancelRemark = cancelRemark; |
| | | } |
| | | |
| | | public Double getCancelPayMoney() { |
| | | return cancelPayMoney; |
| | | } |
| | | |
| | | public void setCancelPayMoney(Double cancelPayMoney) { |
| | | this.cancelPayMoney = cancelPayMoney; |
| | | } |
| | | |
| | | public String getCancelUser() { |
| | | return cancelUser; |
| | | } |
| | | |
| | | public void setCancelUser(String cancelUser) { |
| | | this.cancelUser = cancelUser; |
| | | } |
| | | |
| | | public Integer getReassign() { |
| | | return reassign; |
| | | } |
| | | |
| | | public void setReassign(Integer reassign) { |
| | | this.reassign = reassign; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public Integer getPeopleNumber() { |
| | | return peopleNumber; |
| | | } |
| | | |
| | | public void setPeopleNumber(Integer peopleNumber) { |
| | | this.peopleNumber = peopleNumber; |
| | | } |
| | | |
| | | public String getSeatNumber() { |
| | | return seatNumber; |
| | | } |
| | | |
| | | public void setSeatNumber(String seatNumber) { |
| | | this.seatNumber = seatNumber; |
| | | } |
| | | |
| | | public Integer getCargoType() { |
| | | return cargoType; |
| | | } |
| | | |
| | | public void setCargoType(Integer cargoType) { |
| | | this.cargoType = cargoType; |
| | | } |
| | | |
| | | public Integer getUrgent() { |
| | | return urgent; |
| | | } |
| | | |
| | | public void setUrgent(Integer urgent) { |
| | | this.urgent = urgent; |
| | | } |
| | | |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | public Double getDifferenceMoney() { |
| | | return differenceMoney; |
| | | } |
| | | |
| | | public void setDifferenceMoney(Double differenceMoney) { |
| | | this.differenceMoney = differenceMoney; |
| | | } |
| | | |
| | | public Integer getOrderSource() { |
| | | return orderSource; |
| | | } |
| | | |
| | | public void setOrderSource(Integer orderSource) { |
| | | this.orderSource = orderSource; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "OrderInfoWarpper{" + |
| | | "orderId=" + orderId + |
| | | ", orderState=" + orderState + |
| | | ", orderName='" + orderName + '\'' + |
| | | ", travelTime='" + travelTime + '\'' + |
| | | ", travelTime_='" + travelTime_ + '\'' + |
| | | ", arriveTime='" + arriveTime + '\'' + |
| | | ", startAddress='" + startAddress + '\'' + |
| | | ", endAddress='" + endAddress + '\'' + |
| | | ", tipMoney=" + tipMoney + |
| | | ", startDistance=" + startDistance + |
| | | ", totalDistance=" + totalDistance + |
| | | ", startLon='" + startLon + '\'' + |
| | | ", startLat='" + startLat + '\'' + |
| | | ", endLon='" + endLon + '\'' + |
| | | ", endLat='" + endLat + '\'' + |
| | | ", nickName='" + nickName + '\'' + |
| | | ", phone='" + phone + '\'' + |
| | | ", historyNum=" + historyNum + |
| | | ", orderMoney=" + orderMoney + |
| | | ", payManner=" + payManner + |
| | | ", payMoney=" + payMoney + |
| | | ", isReassign=" + isReassign + |
| | | ", trackId='" + trackId + '\'' + |
| | | ", reservation=" + reservation + |
| | | ", type='" + type + '\'' + |
| | | ", emergencyCall='" + emergencyCall + '\'' + |
| | | ", cancelReason='" + cancelReason + '\'' + |
| | | ", cancelRemark='" + cancelRemark + '\'' + |
| | | ", cancelPayMoney=" + cancelPayMoney + |
| | | ", cancelUser='" + cancelUser + '\'' + |
| | | ", reassign=" + reassign + |
| | | ", remark='" + remark + '\'' + |
| | | ", peopleNumber=" + peopleNumber + |
| | | ", seatNumber='" + seatNumber + '\'' + |
| | | ", cargoType=" + cargoType + |
| | | ", urgent=" + urgent + |
| | | '}'; |
| | | } |
| | | |
| | | public static OrderInfoWarpper getOrderInfoWarpper(Map<String, Object> map){ |
| | | OrderInfoWarpper orderInfoWarpper = new OrderInfoWarpper(); |
| | | if(null != map){ |
| | | orderInfoWarpper.setOrderId(null != map.get("orderId") ? Integer.valueOf(String.valueOf(map.get("orderId"))) : 0); |
| | | orderInfoWarpper.setOrderState(null != map.get("orderState") ? Integer.valueOf(String.valueOf(map.get("orderState"))) : 0); |
| | | orderInfoWarpper.setOrderName(null != map.get("orderName") ? String.valueOf(map.get("orderName")) : ""); |
| | | orderInfoWarpper.setTravelTime(null != map.get("travelTime") ? String.valueOf(map.get("travelTime")) : ""); |
| | | orderInfoWarpper.setTravelTime_(null != map.get("travelTime_") ? String.valueOf(map.get("travelTime_")) : ""); |
| | | orderInfoWarpper.setArriveTime(null != map.get("arriveTime") ? String.valueOf(map.get("arriveTime")) : ""); |
| | | orderInfoWarpper.setStartAddress(null != map.get("startAddress") ? String.valueOf(map.get("startAddress")) : ""); |
| | | orderInfoWarpper.setEndAddress(null != map.get("endAddress") ? String.valueOf(map.get("endAddress")) : ""); |
| | | orderInfoWarpper.setTipMoney(null != map.get("tipMoney") ? Double.valueOf(String.valueOf(map.get("tipMoney"))) : 0); |
| | | orderInfoWarpper.setStartDistance(null != map.get("startDistance") ? Double.valueOf(String.valueOf(map.get("startDistance"))) : 0); |
| | | orderInfoWarpper.setTotalDistance(null != map.get("totalDistance") ? Double.valueOf(String.valueOf(map.get("totalDistance"))) : 0); |
| | | orderInfoWarpper.setStartLon(null != map.get("startLon") ? String.valueOf(map.get("startLon")) : ""); |
| | | orderInfoWarpper.setStartLat(null != map.get("startLat") ? String.valueOf(map.get("startLat")) : ""); |
| | | orderInfoWarpper.setEndLon(null != map.get("endLon") ? String.valueOf(map.get("endLon")) : ""); |
| | | orderInfoWarpper.setEndLat(null != map.get("endLat") ? String.valueOf(map.get("endLat")) : ""); |
| | | orderInfoWarpper.setNickName(null != map.get("nickName") ? String.valueOf(map.get("nickName")) : ""); |
| | | orderInfoWarpper.setPhone(null != map.get("telX") ? String.valueOf(map.get("telX")) : (null != map.get("phone") ? String.valueOf(map.get("phone")) : "")); |
| | | orderInfoWarpper.setHistoryNum(null != map.get("historyNum") ? Integer.valueOf(String.valueOf(map.get("historyNum"))) : 0); |
| | | orderInfoWarpper.setOrderMoney(null != map.get("orderMoney") ? Double.valueOf(String.valueOf(map.get("orderMoney"))) : 0); |
| | | orderInfoWarpper.setPayManner(null != map.get("payManner") ? Integer.valueOf(String.valueOf(map.get("payManner"))) : 0); |
| | | orderInfoWarpper.setPayMoney(null != map.get("payMoney") ? Double.valueOf(String.valueOf(map.get("payMoney"))) : 0); |
| | | orderInfoWarpper.setIsReassign(null != map.get("isReassign") ? Integer.valueOf(String.valueOf(map.get("isReassign"))) : 1); |
| | | orderInfoWarpper.setTrackId(null != map.get("trackId") ? String.valueOf(map.get("trackId")) : ""); |
| | | orderInfoWarpper.setReservation(null != map.get("reservation") ? Integer.valueOf(String.valueOf(map.get("reservation"))) : 0); |
| | | orderInfoWarpper.setType(null != map.get("type") ? String.valueOf(map.get("type")) : ""); |
| | | orderInfoWarpper.setEmergencyCall(null != map.get("emergencyCall") ? String.valueOf(map.get("emergencyCall")) : ""); |
| | | orderInfoWarpper.setCancelReason(null != map.get("cancelReason") ? String.valueOf(map.get("cancelReason")) : ""); |
| | | orderInfoWarpper.setCancelRemark(null != map.get("cancelRemark") ? String.valueOf(map.get("cancelRemark")) : ""); |
| | | orderInfoWarpper.setCancelPayMoney(null != map.get("cancelPayMoney") ? Double.valueOf(String.valueOf(map.get("cancelPayMoney"))) : 0); |
| | | orderInfoWarpper.setCancelUser(null != map.get("cancelUser") ? String.valueOf(map.get("cancelUser")) : ""); |
| | | orderInfoWarpper.setReassign(null != map.get("reassign") ? Integer.valueOf(String.valueOf(map.get("reassign"))) : 1); |
| | | orderInfoWarpper.setPeopleNumber(null != map.get("peopleNumber") ? Integer.valueOf(String.valueOf(map.get("peopleNumber"))) : 1); |
| | | orderInfoWarpper.setRemark(null != map.get("remark") ? String.valueOf(map.get("remark")) : ""); |
| | | orderInfoWarpper.setSeatNumber(null != map.get("seatNumber") ? String.valueOf(map.get("seatNumber")) : ""); |
| | | orderInfoWarpper.setCargoType(null != map.get("cargoType") ? Integer.valueOf(map.get("cargoType").toString()) : 0); |
| | | orderInfoWarpper.setUrgent(null != map.get("urgent") ? Integer.valueOf(map.get("urgent").toString()) : 0); |
| | | orderInfoWarpper.setUserName(null != map.get("userName") ? String.valueOf(map.get("userName")) : ""); |
| | | orderInfoWarpper.setDifferenceMoney(null != map.get("differenceMoney") ? Double.valueOf(map.get("differenceMoney").toString()) : 0D); |
| | | orderInfoWarpper.setOrderSource(null != map.get("orderSource") ? Integer.valueOf(map.get("orderSource").toString()) : 0); |
| | | } |
| | | return orderInfoWarpper; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @ApiModel("订单列表") |
| | | public class OrderListWarpper implements Comparable { |
| | | @ApiModelProperty("订单id") |
| | | private Integer id; |
| | | @ApiModelProperty("订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车)") |
| | | private Integer type; |
| | | @ApiModelProperty("订单名称") |
| | | private String name; |
| | | @ApiModelProperty("订单时间") |
| | | private String time; |
| | | @ApiModelProperty("出发地") |
| | | private String startAddress; |
| | | @ApiModelProperty("目的地") |
| | | private String endAddress; |
| | | @ApiModelProperty("红包金额") |
| | | private Double redMoney; |
| | | @ApiModelProperty("订单金额") |
| | | private Double orderMoney; |
| | | @ApiModelProperty("订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中)<br/>" + |
| | | "小件物流订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待取货,5=送货中,6=已送达,7=待支付,8=需补差价,9=已取货,10=已取消,11=已支付差价)") |
| | | private Integer state; |
| | | @ApiModelProperty("人数") |
| | | private Integer peopleNumber; |
| | | @ApiModelProperty("下单用户") |
| | | private String user; |
| | | @ApiModelProperty("货物信息") |
| | | private String cargoNumber; |
| | | @ApiModelProperty("备注") |
| | | private String remark; |
| | | @ApiModelProperty("支付方式(1=OK平台支付(线上支付),2=其他方式支付(线下支付))") |
| | | private Integer payManner; |
| | | private Long travelTime; |
| | | |
| | | 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 getTime() { |
| | | return time; |
| | | } |
| | | |
| | | public void setTime(String time) { |
| | | this.time = time; |
| | | } |
| | | |
| | | public String getStartAddress() { |
| | | return startAddress; |
| | | } |
| | | |
| | | public void setStartAddress(String startAddress) { |
| | | this.startAddress = startAddress; |
| | | } |
| | | |
| | | public String getEndAddress() { |
| | | return endAddress; |
| | | } |
| | | |
| | | public void setEndAddress(String endAddress) { |
| | | this.endAddress = endAddress; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Double getRedMoney() { |
| | | return redMoney; |
| | | } |
| | | |
| | | public void setRedMoney(Double redMoney) { |
| | | this.redMoney = redMoney; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Double getOrderMoney() { |
| | | return orderMoney; |
| | | } |
| | | |
| | | public void setOrderMoney(Double orderMoney) { |
| | | this.orderMoney = orderMoney; |
| | | } |
| | | |
| | | public Integer getPeopleNumber() { |
| | | return peopleNumber; |
| | | } |
| | | |
| | | public void setPeopleNumber(Integer peopleNumber) { |
| | | this.peopleNumber = peopleNumber; |
| | | } |
| | | |
| | | public String getUser() { |
| | | return user; |
| | | } |
| | | |
| | | public void setUser(String user) { |
| | | this.user = user; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public Integer getPayManner() { |
| | | return payManner; |
| | | } |
| | | |
| | | public void setPayManner(Integer payManner) { |
| | | this.payManner = payManner; |
| | | } |
| | | |
| | | public Long getTravelTime() { |
| | | return travelTime; |
| | | } |
| | | |
| | | public void setTravelTime(Long travelTime) { |
| | | this.travelTime = travelTime; |
| | | } |
| | | |
| | | public String getCargoNumber() { |
| | | return cargoNumber; |
| | | } |
| | | |
| | | public void setCargoNumber(String cargoNumber) { |
| | | this.cargoNumber = cargoNumber; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "OrderListWarpper{" + |
| | | "id=" + id + |
| | | ", type=" + type + |
| | | ", name='" + name + '\'' + |
| | | ", time='" + time + '\'' + |
| | | ", startAddress='" + startAddress + '\'' + |
| | | ", endAddress='" + endAddress + '\'' + |
| | | ", redMoney=" + redMoney + |
| | | ", orderMoney=" + orderMoney + |
| | | ", state=" + state + |
| | | ", peopleNumber=" + peopleNumber + |
| | | ", user='" + user + '\'' + |
| | | ", remark='" + remark + '\'' + |
| | | ", payManner=" + payManner + |
| | | '}'; |
| | | } |
| | | |
| | | public static List<OrderListWarpper> getOrderListWarpper(List<Map<String, Object>> maps){ |
| | | List<OrderListWarpper> list = new ArrayList<>(); |
| | | if(null != maps){ |
| | | for(Map<String, Object> map : maps){ |
| | | OrderListWarpper orderListWarpper = new OrderListWarpper(); |
| | | orderListWarpper.setId(null != map.get("id") ? Integer.valueOf(String.valueOf(map.get("id"))) : 0); |
| | | orderListWarpper.setName(null != map.get("name") ? String.valueOf(map.get("name")) : ""); |
| | | orderListWarpper.setTime(null != map.get("time") ? String.valueOf(map.get("time")) : ""); |
| | | orderListWarpper.setStartAddress(null != map.get("startAddress") ? String.valueOf(map.get("startAddress")) : ""); |
| | | orderListWarpper.setEndAddress(null != map.get("endAddress") ? String.valueOf(map.get("endAddress")) : ""); |
| | | orderListWarpper.setState(null != map.get("state") ? Integer.valueOf(String.valueOf(map.get("state"))) : 0); |
| | | orderListWarpper.setRedMoney(null != map.get("redMoney") ? Double.valueOf(String.valueOf(map.get("redMoney"))) : 0); |
| | | orderListWarpper.setOrderMoney(null != map.get("orderMoney") ? Double.valueOf(String.valueOf(map.get("orderMoney"))) : 0); |
| | | orderListWarpper.setType(null != map.get("type") ? Integer.valueOf(String.valueOf(map.get("type"))) : 0); |
| | | orderListWarpper.setPeopleNumber(null != map.get("peopleNumber") ? Integer.valueOf(String.valueOf(map.get("peopleNumber"))) : 0); |
| | | orderListWarpper.setUser(null != map.get("user") ? String.valueOf(map.get("user")) : ""); |
| | | orderListWarpper.setCargoNumber(null != map.get("cargoNumber") ? String.valueOf(map.get("cargoNumber")) : ""); |
| | | orderListWarpper.setRemark(null != map.get("remark") ? String.valueOf(map.get("remark")) : ""); |
| | | orderListWarpper.setPayManner(null != map.get("payManner") ? Integer.valueOf(String.valueOf(map.get("payManner"))) : 0); |
| | | orderListWarpper.setTravelTime(null != map.get("travelTime") ? Long.valueOf(String.valueOf(map.get("travelTime"))) : 0); |
| | | list.add(orderListWarpper); |
| | | } |
| | | } |
| | | Collections.sort(list); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public int compareTo(Object o) { |
| | | if (o instanceof OrderListWarpper) { |
| | | OrderListWarpper s = (OrderListWarpper) o; |
| | | if(this.travelTime == null || s.travelTime == null){ |
| | | return -1; |
| | | } |
| | | if (this.travelTime > s.travelTime) { |
| | | return -1; |
| | | } else if (this.travelTime == s.travelTime) { |
| | | return 0; |
| | | } else { |
| | | return 1; |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | @ApiModel("订单状态") |
| | | public class OrderStatusWarpper { |
| | | @ApiModelProperty("订单id") |
| | | private Integer orderId; |
| | | @ApiModelProperty("订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车)") |
| | | private Integer orderType; |
| | | @ApiModelProperty("订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中)") |
| | | private Integer state; |
| | | |
| | | public Integer getOrderId() { |
| | | return orderId; |
| | | } |
| | | |
| | | public void setOrderId(Integer orderId) { |
| | | this.orderId = orderId; |
| | | } |
| | | |
| | | public Integer getOrderType() { |
| | | return orderType; |
| | | } |
| | | |
| | | public void setOrderType(Integer orderType) { |
| | | this.orderType = orderType; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | @ApiModel("可接单业务") |
| | | public class OrdersWarpper { |
| | | @ApiModelProperty("类型") |
| | | private Integer type; |
| | | @ApiModelProperty("类型名称") |
| | | private String name; |
| | | @ApiModelProperty("是否已设置(1=否,2=是)") |
| | | private Integer state; |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @ApiModel("司机注册信息") |
| | | public class RegisteredWarpper { |
| | | @ApiModelProperty("电话") |
| | | private String phone; |
| | | @ApiModelProperty("密码") |
| | | private String password; |
| | | @ApiModelProperty("姓名") |
| | | private String name; |
| | | @ApiModelProperty("性别(1=男,2=女)") |
| | | private Integer sex; |
| | | @ApiModelProperty("居住地") |
| | | private String driverContactAddress; |
| | | @ApiModelProperty("居住地(带分隔符)") |
| | | private String driverContactAddress_; |
| | | @ApiModelProperty("身份证号码") |
| | | private String idCard; |
| | | @ApiModelProperty("身份证正面照") |
| | | private String idCardImgUrl1; |
| | | @ApiModelProperty("身份证背面照") |
| | | private String idCardImgUrl2; |
| | | @ApiModelProperty("初次领取驾驶证日期") |
| | | private Date getDriverLicenseDate; |
| | | @ApiModelProperty("服务模式(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车)多个以逗号分隔") |
| | | private String type; |
| | | @ApiModelProperty("从业地行政代码(510100)") |
| | | private String placeOfEmployment; |
| | | @ApiModelProperty("从业地地址(带分隔符)") |
| | | private String placeOfPractice; |
| | | @ApiModelProperty("头像") |
| | | private String headImgUrl; |
| | | @ApiModelProperty("驾驶证照片") |
| | | private String driveCardImgUrl; |
| | | @ApiModelProperty("网约车资格证照片") |
| | | private String networkCarlssueImg; |
| | | @ApiModelProperty("出租车资格证号") |
| | | private String taxiAptitudeCard; |
| | | |
| | | |
| | | public String getPhone() { |
| | | return phone; |
| | | } |
| | | |
| | | public void setPhone(String phone) { |
| | | this.phone = phone; |
| | | } |
| | | |
| | | public String getPassword() { |
| | | return password; |
| | | } |
| | | |
| | | public void setPassword(String password) { |
| | | this.password = password; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Integer getSex() { |
| | | return sex; |
| | | } |
| | | |
| | | public void setSex(Integer sex) { |
| | | this.sex = sex; |
| | | } |
| | | |
| | | public String getDriverContactAddress() { |
| | | return driverContactAddress; |
| | | } |
| | | |
| | | public void setDriverContactAddress(String driverContactAddress) { |
| | | this.driverContactAddress = driverContactAddress; |
| | | } |
| | | |
| | | public String getIdCard() { |
| | | return idCard; |
| | | } |
| | | |
| | | public void setIdCard(String idCard) { |
| | | this.idCard = idCard; |
| | | } |
| | | |
| | | public String getIdCardImgUrl1() { |
| | | return idCardImgUrl1; |
| | | } |
| | | |
| | | public void setIdCardImgUrl1(String idCardImgUrl1) { |
| | | this.idCardImgUrl1 = idCardImgUrl1; |
| | | } |
| | | |
| | | public String getIdCardImgUrl2() { |
| | | return idCardImgUrl2; |
| | | } |
| | | |
| | | public void setIdCardImgUrl2(String idCardImgUrl2) { |
| | | this.idCardImgUrl2 = idCardImgUrl2; |
| | | } |
| | | |
| | | public Date getGetDriverLicenseDate() { |
| | | return getDriverLicenseDate; |
| | | } |
| | | |
| | | public void setGetDriverLicenseDate(Date getDriverLicenseDate) { |
| | | this.getDriverLicenseDate = getDriverLicenseDate; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getPlaceOfEmployment() { |
| | | return placeOfEmployment; |
| | | } |
| | | |
| | | public void setPlaceOfEmployment(String placeOfEmployment) { |
| | | this.placeOfEmployment = placeOfEmployment; |
| | | } |
| | | |
| | | public String getHeadImgUrl() { |
| | | return headImgUrl; |
| | | } |
| | | |
| | | public void setHeadImgUrl(String headImgUrl) { |
| | | this.headImgUrl = headImgUrl; |
| | | } |
| | | |
| | | public String getDriveCardImgUrl() { |
| | | return driveCardImgUrl; |
| | | } |
| | | |
| | | public void setDriveCardImgUrl(String driveCardImgUrl) { |
| | | this.driveCardImgUrl = driveCardImgUrl; |
| | | } |
| | | |
| | | public String getNetworkCarlssueImg() { |
| | | return networkCarlssueImg; |
| | | } |
| | | |
| | | public void setNetworkCarlssueImg(String networkCarlssueImg) { |
| | | this.networkCarlssueImg = networkCarlssueImg; |
| | | } |
| | | |
| | | public String getTaxiAptitudeCard() { |
| | | return taxiAptitudeCard; |
| | | } |
| | | |
| | | public void setTaxiAptitudeCard(String taxiAptitudeCard) { |
| | | this.taxiAptitudeCard = taxiAptitudeCard; |
| | | } |
| | | |
| | | public String getDriverContactAddress_() { |
| | | return driverContactAddress_; |
| | | } |
| | | |
| | | public void setDriverContactAddress_(String driverContactAddress_) { |
| | | this.driverContactAddress_ = driverContactAddress_; |
| | | } |
| | | |
| | | public String getPlaceOfPractice() { |
| | | return placeOfPractice; |
| | | } |
| | | |
| | | public void setPlaceOfPractice(String placeOfPractice) { |
| | | this.placeOfPractice = placeOfPractice; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "RegisteredWarpper{" + |
| | | "phone='" + phone + '\'' + |
| | | ", password='" + password + '\'' + |
| | | ", name='" + name + '\'' + |
| | | ", sex=" + sex + |
| | | ", driverContactAddress='" + driverContactAddress + '\'' + |
| | | ", idCard='" + idCard + '\'' + |
| | | ", idCardImgUrl1='" + idCardImgUrl1 + '\'' + |
| | | ", idCardImgUrl2='" + idCardImgUrl2 + '\'' + |
| | | ", getDriverLicenseDate=" + getDriverLicenseDate + |
| | | ", type=" + type + |
| | | ", placeOfEmployment='" + placeOfEmployment + '\'' + |
| | | ", headImgUrl='" + headImgUrl + '\'' + |
| | | ", driveCardImgUrl='" + driveCardImgUrl + '\'' + |
| | | ", networkCarlssueImg='" + networkCarlssueImg + '\'' + |
| | | ", taxiAptitudeCard='" + taxiAptitudeCard + '\'' + |
| | | '}'; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import com.supersavedriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.supersavedriving.user.core.base.warpper.BaseControllerWarpper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 角色列表的包装类 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017年2月19日10:59:02 |
| | | */ |
| | | public class RoleWarpper extends BaseControllerWarpper { |
| | | |
| | | public RoleWarpper(List<Map<String, Object>> list) { |
| | | super(list); |
| | | } |
| | | |
| | | @Override |
| | | public void warpTheMap(Map<String, Object> map) { |
| | | map.put("pName", ConstantFactory.me().getSingleRoleName((Integer) map.get("pid"))); |
| | | map.put("deptName", ConstantFactory.me().getDeptName((Integer) map.get("deptid"))); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @ApiModel("消息类表") |
| | | public class SystemNoticeWarpper { |
| | | @ApiModelProperty("主键") |
| | | private Integer id; |
| | | @ApiModelProperty("类型(1=公告,2=系统消息)") |
| | | private Integer type; |
| | | @ApiModelProperty("标题") |
| | | private String title; |
| | | @ApiModelProperty("内容") |
| | | private String content; |
| | | @ApiModelProperty("图片") |
| | | private String img; |
| | | @ApiModelProperty("时间") |
| | | private String time; |
| | | @ApiModelProperty("阅读状态(1=未读,2=已读)") |
| | | private Integer read; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | public String getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(String content) { |
| | | this.content = content; |
| | | } |
| | | |
| | | public String getImg() { |
| | | return img; |
| | | } |
| | | |
| | | public void setImg(String img) { |
| | | this.img = img; |
| | | } |
| | | |
| | | public String getTime() { |
| | | return time; |
| | | } |
| | | |
| | | public void setTime(String time) { |
| | | this.time = time; |
| | | } |
| | | |
| | | public Integer getRead() { |
| | | return read; |
| | | } |
| | | |
| | | public void setRead(Integer read) { |
| | | this.read = read; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "SystemNoticeWarpper{" + |
| | | "id=" + id + |
| | | ", type=" + type + |
| | | ", title='" + title + '\'' + |
| | | ", content='" + content + '\'' + |
| | | ", img='" + img + '\'' + |
| | | ", time='" + time + '\'' + |
| | | '}'; |
| | | } |
| | | |
| | | |
| | | public static List<SystemNoticeWarpper> getSystemNoticeWarpper(List<Map<String, Object>> maps){ |
| | | List<SystemNoticeWarpper> list = new ArrayList<>(); |
| | | if(null != maps){ |
| | | for(Map<String, Object> map : maps){ |
| | | SystemNoticeWarpper systemNoticeWarpper = new SystemNoticeWarpper(); |
| | | systemNoticeWarpper.setId(null != map.get("id") ? Integer.valueOf(String.valueOf(map.get("id"))) : 0); |
| | | systemNoticeWarpper.setType(null != map.get("type") ? Integer.valueOf(String.valueOf(map.get("type"))) : 0); |
| | | systemNoticeWarpper.setTitle(null != map.get("title") ? String.valueOf(map.get("title")) : ""); |
| | | systemNoticeWarpper.setContent(null != map.get("content") ? String.valueOf(map.get("content")) : ""); |
| | | systemNoticeWarpper.setImg(null != map.get("img") ? String.valueOf(map.get("img")) : ""); |
| | | systemNoticeWarpper.setTime(null != map.get("time") ? String.valueOf(map.get("time")) : ""); |
| | | systemNoticeWarpper.setRead(null != map.get("read") ? Integer.valueOf(String.valueOf(map.get("read"))) : 0); |
| | | list.add(systemNoticeWarpper); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import com.supersavedriving.user.core.common.constant.factory.ConstantFactory; |
| | | import com.supersavedriving.user.core.base.warpper.BaseControllerWarpper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 用户管理的包装类 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017年2月13日 下午10:47:03 |
| | | */ |
| | | public class UserWarpper extends BaseControllerWarpper { |
| | | |
| | | public UserWarpper(List<Map<String, Object>> list) { |
| | | super(list); |
| | | } |
| | | |
| | | @Override |
| | | public void warpTheMap(Map<String, Object> map) { |
| | | map.put("sexName", ConstantFactory.me().getSexName((Integer) map.get("sex"))); |
| | | map.put("roleName", ConstantFactory.me().getRoleName((String) map.get("roleid"))); |
| | | map.put("deptName", ConstantFactory.me().getDeptName((Integer) map.get("deptid"))); |
| | | map.put("statusName", ConstantFactory.me().getStatusName((Integer) map.get("status"))); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @ApiModel("版本") |
| | | public class VersionWarpper { |
| | | @ApiModelProperty("主键") |
| | | private Integer id = 0; |
| | | @ApiModelProperty("包地址") |
| | | private String url; |
| | | @ApiModelProperty("版本说明") |
| | | private String content; |
| | | @ApiModelProperty("是否强制更新(0=否,1=是)") |
| | | private Integer mandatory = 0; |
| | | @ApiModelProperty("版本号") |
| | | private String version; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getUrl() { |
| | | return url; |
| | | } |
| | | |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | public String getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(String content) { |
| | | this.content = content; |
| | | } |
| | | |
| | | public Integer getMandatory() { |
| | | return mandatory; |
| | | } |
| | | |
| | | public void setMandatory(Integer mandatory) { |
| | | this.mandatory = mandatory; |
| | | } |
| | | |
| | | public String getVersion() { |
| | | return version; |
| | | } |
| | | |
| | | public void setVersion(String version) { |
| | | this.version = version; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "VersionWarpper{" + |
| | | "id=" + id + |
| | | ", url='" + url + '\'' + |
| | | ", content='" + content + '\'' + |
| | | ", mandatory=" + mandatory + |
| | | ", version='" + version + '\'' + |
| | | '}'; |
| | | } |
| | | |
| | | |
| | | public static VersionWarpper getVersionWarpper(Map<String, Object> map){ |
| | | VersionWarpper versionWarpper = new VersionWarpper(); |
| | | if(null != map){ |
| | | versionWarpper.setId(null != map.get("id") ? Integer.valueOf(String.valueOf(map.get("id"))) : 0); |
| | | versionWarpper.setUrl(null != map.get("url") ? String.valueOf(map.get("url")) : ""); |
| | | versionWarpper.setContent(null != map.get("content") ? String.valueOf(map.get("content")) : ""); |
| | | versionWarpper.setMandatory(null != map.get("mandatory") ? Integer.valueOf(String.valueOf(map.get("mandatory"))) : 0); |
| | | versionWarpper.setVersion(null != map.get("version") ? String.valueOf(map.get("version")) : ""); |
| | | } |
| | | return versionWarpper; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @ApiModel("提现历史记录") |
| | | public class WithdrawalWarpper { |
| | | @ApiModelProperty("主键") |
| | | private Integer id; |
| | | @ApiModelProperty("提现时间") |
| | | private String insertTime; |
| | | @ApiModelProperty("提现金额") |
| | | private Double money; |
| | | @ApiModelProperty("提现方式") |
| | | private String name; |
| | | @ApiModelProperty("备注") |
| | | private String remark; |
| | | @ApiModelProperty("提现状态(1=待处理,2=成功,3=失败)") |
| | | private Integer state; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(String insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | public Double getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(Double money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "WithdrawalWarpper{" + |
| | | "id=" + id + |
| | | ", insertTime='" + insertTime + '\'' + |
| | | ", money=" + money + |
| | | ", name='" + name + '\'' + |
| | | ", remark='" + remark + '\'' + |
| | | ", state=" + state + |
| | | '}'; |
| | | } |
| | | |
| | | public static List<WithdrawalWarpper> getWithdrawalWarpper(List<Map<String, Object>> maps){ |
| | | List<WithdrawalWarpper> list = new ArrayList<>(); |
| | | if(null != maps){ |
| | | for(Map<String, Object> map : maps){ |
| | | WithdrawalWarpper withdrawalWarpper = new WithdrawalWarpper(); |
| | | withdrawalWarpper.setId(null != map.get("id") ? Integer.valueOf(String.valueOf(map.get("id"))) : 0); |
| | | withdrawalWarpper.setMoney(null != map.get("money") ? Double.valueOf(String.valueOf(map.get("money"))) : 0); |
| | | withdrawalWarpper.setName(null != map.get("name") ? String.valueOf(map.get("name")) : ""); |
| | | withdrawalWarpper.setRemark(null != map.get("remark") ? String.valueOf(map.get("remark")) : ""); |
| | | withdrawalWarpper.setState(null != map.get("state") ? Integer.valueOf(String.valueOf(map.get("state"))) : 0); |
| | | withdrawalWarpper.setInsertTime(null != map.get("insertTime") ? String.valueOf(map.get("insertTime")) : ""); |
| | | list.add(withdrawalWarpper); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | } |
New file |
| | |
| | | restart.include.beetl=/beetl-2.8.5.jar |
New file |
| | |
| | | server: |
| | | port: 8006 |
| | | |
| | | guns: |
| | | swagger-open: true #是否开启swagger (true/false) |
| | | kaptcha-open: false #是否开启登录时验证码 (true/false) |
| | | # file-upload-path: d:/tmp #文件上传目录(不配置的话为java.io.tmpdir目录) |
| | | spring-session-open: false #是否开启spring session,如果是多机环境需要开启(true/false) |
| | | session-invalidate-time: 1800 #session失效时间(只在单机环境下生效,多机环境在SpringSessionConfig类中配置) 单位:秒 |
| | | session-validation-interval: 900 #多久检测一次失效的session(只在单机环境下生效) 单位:秒 |
| | | |
| | | spring: |
| | | application: |
| | | name: user-server |
| | | profiles: |
| | | active: dev |
| | | # active: produce |
| | | mvc: |
| | | static-path-pattern: /static/** |
| | | view: |
| | | prefix: /WEB-INF/view |
| | | devtools: |
| | | restart: |
| | | enabled: false |
| | | additional-paths: src/main/java |
| | | exclude: static/**,WEB-INF/view/** |
| | | servlet: |
| | | multipart: |
| | | max-request-size: 100MB |
| | | max-file-size: 100MB |
| | | |
| | | mybatis-plus: |
| | | typeAliasesPackage: com.supersavedriving.user.modular |
| | | global-config: |
| | | id-type: 0 #0:数据库ID自增 1:用户输入id 2:全局唯一id(IdWorker) 3:全局唯一ID(uuid) |
| | | db-column-underline: false |
| | | configuration: |
| | | configuration.map-underscore-to-camel-case: true #是否开启自动驼峰命名规则(camel case)映射 |
| | | log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl #输出Sql,如需打印Sql注释该配置 |
| | | |
| | | |
| | | |
| | | eureka: |
| | | client: |
| | | service-url: #注册中心地址 |
| | | defaultZone: http://sinata:sinata@127.0.0.1:8000/eureka #启用身份验证的方式连接 |
| | | register-with-eureka: true #在注册中心进行注册 |
| | | fetch-registry: true #从Eureka中获取注册信息。 |
| | | |
| | | --- |
| | | |
| | | #spring: |
| | | # datasource: |
| | | # url: jdbc:mysql://Rm-wz9rpe0t74ys3b1h8go.mysql.rds.aliyuncs.com:3306/oktravel?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai |
| | | # username: root |
| | | # password: Root2020! |
| | | # db-name: guns #用来搜集数据库的所有表 |
| | | # filters: wall,mergeStat |
| | | |
| | | |
| | | spring: |
| | | datasource: |
| | | url: jdbc:mysql://127.0.0.1:3306/super_save_driving?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: root |
| | | password: 123456 |
| | | db-name: guns #用来搜集数据库的所有表 |
| | | filters: wall,mergeStat |
| | | |
| | | #多数据源情况的配置 |
| | | guns: |
| | | muti-datasource: |
| | | open: false |
| | | url: jdbc:mysql://127.0.0.1:3306/guns_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: root |
| | | password: root |
| | | dataSourceNames: |
| | | - dataSourceGuns |
| | | - dataSourceBiz |
| | | |
| | | |
| | | |
| | | --- |
| | | |
| | | wx: |
| | | grantType: authorization_code #填authorization_code |
| | | appid: wx36c966d381cd5d62 #应用唯一标识,在微信开放平台提交应用审核通过后获得 |
| | | appSecret: cf4b21c7175356f41fa3c426f26c20e4 #应用密钥AppSecret,在微信开放平台提交应用审核通过后获得 |
| | | appletsAppid: #小程序APPid |
| | | appletsAppSecret: # |
| | | mchId: 1593080081 #微信支付分配的商户号 |
| | | key: JnhREmZwHNKyFUQPEhijp1gdaCUzKg8P #key为商户平台设置的密钥key: |
| | | |
| | | --- |
| | | |
| | | alipay: |
| | | appid: 2021001161600393 #应用程序唯一标识 |
| | | appPrivateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCEbTcG2wz+kaYDo2YxflpHE59MvKc3rbl6RlBgO6i5GzgphzeRTv5kRWUpSVkKCsbxFvAYLcgFPmm5nY2fz5hCTKiRcYfpUjH/OougUbzYU3ilUc9JqMbmvy7KN+Kv7+kQYCGLvMqlyYPiJ7LrmJLpE/FUcNLDwo6xUmwJSxaF7M4TbD3ZQZdddki1iJp9GihlqehZCMWOBeotEXvPKDEzSEkYlnvHPQaaspVgeesGmlHDuOiZUokENutxpjo7klWe97NA49hXEtI+xlczNGJKdBr0keBX/kSMsnx8kMxYDjh4QTySBaR6zlO4RYPFekWv9QZ2CrfiKCS7AHUpZYZ5AgMBAAECggEAXjCoUPIBHhhOcowIJe/vGlr0lUohzdJ8+GGGzcvhSDf6DF+mwG3lN0C8oU8QS7o6okRkZW46tLAd1u4fS6oGbDHGPBz6RJQ4B4eGxHMe1OcaCsxTmdq4DmuxRhfV3rnPldwqQA/6O01HxtXhxvzwkWOj5SGSZ7a8c5diTIHh9ULd6neUI/rIFC97mH1TeW0uDIxAtyvswz0pIfDhAR+lsOyTg/8qzsIXjpBFG4gAVxhUeUqQA5HzbsFglC08V7ViDk1OEoWi3yIj1CmNdtntJI4cxqLgTK7MNB9udhbN2I9YasuIpZvlAcvPi5R9cYT8vvFBCFGM+i22wtcsQmxdAQKBgQDaD9y6WNmsp+IaAUG3FqbJC8SqwreGIiEflWwVjrd+LuN6yhyr45CobOmhbTz0de8gRJEZKgJZEJcywL1ScrPIC4n1JaG688lk5aR+0Lik5fy1+L6G/CydJoJqlh6KKdwPJmDGpVu/geLJcLkWcYOwL56IL7GK2JI1p607R0x6iQKBgQCbd0n4xG9GkpvW4LDAJiMEhwPu9QcCKIT0mXVXCgMFdWel9bY3+8RSZoziWutaofm9tRHFAqwjbRyOZ+EdckkNsWVkkTnkKGtAhYKgM0GaOwdMFxmvME5WYJ74a5t1jiezDmR3obUBtS2nyQ8CFPUnlimoTR9F6APrth3h8uvwcQKBgFWaCn1AqdrEYNbyjViRVNHxg7fBDohiV3xtjOt9hfzL7VLjipPTlpL3hlNvbZFNxpx1LjyhqCBMif5LeUanbnnmRbbtmeqpDvNDzupVh1Z8TlMlHa4hymW6m1G6MqzsN83es/jnKvgnxd5sGMx9rUN5vhMaHekykVrswu1VVOl5AoGAMDljh7gfMEv/7TqLeT8bM6dR8AivoNrCy0Di5hnj8AiIGzHJ0TnWnxzSbNB5GwcNeew109/NV7vb1MyiRskRoh657eUiiQSEqGIBsAHWQqo2zEKKJA6e7ipQhYyTj3aGGAPJ5FYT2LDDtb0nW6T2ms34pA0wOzYKKU63nEQHLfECgYEAgbbpZJRtPxWB1M/Dg7loguT5O/VUsKefS0JrSD+tJIqYkumH5mejvYW5YEeDdelkvBhAEFUW9JOkzL+1w1g3wz2QQ2aPV/r55cJE3EfOzbwgw6GsO+8UuyiavbFhS3pFZNI0pR5M3u1+SIcLqQCnYLbO11vnEXglB6wjw9/oxPE= #开发者应用私钥 |
| | | alipayPublicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhG03BtsM/pGmA6NmMX5aRxOfTLynN625ekZQYDuouRs4KYc3kU7+ZEVlKUlZCgrG8RbwGC3IBT5puZ2Nn8+YQkyokXGH6VIx/zqLoFG82FN4pVHPSajG5r8uyjfir+/pEGAhi7zKpcmD4iey65iS6RPxVHDSw8KOsVJsCUsWhezOE2w92UGXXXZItYiafRooZanoWQjFjgXqLRF7zygxM0hJGJZ7xz0GmrKVYHnrBppRw7jomVKJBDbrcaY6O5JVnvezQOPYVxLSPsZXMzRiSnQa9JHgV/5EjLJ8fJDMWA44eEE8kgWkes5TuEWDxXpFr/UGdgq34igkuwB1KWWGeQIDAQAB #应用公钥 |
| | | alipay_public_key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzmDrvcNvhexu3KkxVS9bemdSn6pyQUFmpyOGMDOirGR+RbmldpH2N9bPegzZynb5+bmRHii4ib31XeoXc7M7r6UsPhmPeLoSBNwpC+Uig0VxPa0hmvHjAl6StArhB3eMib6Zo40nM6eCYZLLZ1kKpI5Ad/APov9uLrbSnoeZsgeRibQix07arvTEsZq6pJavNlA+UBjp65o6Bv0+kfQ65pMTpbu+jRtTzkTj1hoW9PjwlWrY21F1FvN67zDWkTB2LjGFsqan0Qoe4/X8nK3VsDvkjIm/ZQsnQr8ZzfcuTzQPrcZpo3h9DPZoHeiToEfXtyk7E0bQHEmYVpmrvk/IJwIDAQAB #支付宝公钥 |
| | | |
| | | --- |
| | | |
| | | juhe: #聚合数据 |
| | | appKey: 0d3fd83eddaa33e5563f548257648577 # |
| | | |
| | | |
| | | --- |
| | | |
| | | jiguang: |
| | | appKey-driver: 93204c35ded9ba377a14af19 #极光推送应用唯一标识 |
| | | masterSecret-driver: e4f6f435faefad29db6ba9b2 #用于服务器端 API 调用时与 AppKey 配合使用达到鉴权的目的 |
| | | appKey-dispatch: cc212ee6dcecb26625917f40 #极光推送应用唯一标识 |
| | | masterSecret-dispatch: 0d163a25a20647665c28639e #用于服务器端 API 调用时与 AppKey 配合使用达到鉴权的目的 |
| | | |
| | | |
| | | --- |
| | | |
| | | filePath: /usr/local/server/orderPostionFile/ #存储订单轨迹文件路径 |
| | | #filePath: C:/orderPostionFile/ #存储订单轨迹文件路径 |
| | | |
| | | |
| | | |
| | | #支付回调地址 |
| | | #正式环境 |
| | | callbackPath: https://okyueche.com:443/driver |
| | | #正式测试环境 |
| | | #callbackPath: http://39.108.148.228:80/driver |
| | | |
| | | --- |
| | | #交通部推送数据功能开关 |
| | | pushMinistryOfTransport: false |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:noNamespaceSchemaLocation="ehcache.xsd" |
| | | updateCheck="false" monitoring="autodetect" |
| | | dynamicConfig="true" > |
| | | |
| | | <diskStore path="java.io.tmpdir/ehcache"/> |
| | | |
| | | <defaultCache |
| | | maxElementsInMemory="50000" |
| | | eternal="false" |
| | | timeToIdleSeconds="3600" |
| | | timeToLiveSeconds="3600" |
| | | overflowToDisk="true" |
| | | diskPersistent="false" |
| | | diskExpiryThreadIntervalSeconds="120" |
| | | /> |
| | | |
| | | <!-- 全局变量:永不过期--> |
| | | <cache name="CONSTANT" |
| | | maxElementsInMemory="50000" |
| | | eternal="true" |
| | | clearOnFlush="false" |
| | | overflowToDisk="true" |
| | | diskSpoolBufferSizeMB="1024" |
| | | maxElementsOnDisk="100000" |
| | | diskPersistent="false" |
| | | diskExpiryThreadIntervalSeconds="120" |
| | | memoryStoreEvictionPolicy="LFU" |
| | | transactionalMode="off"> |
| | | </cache> |
| | | |
| | | </ehcache> |
| | | |
| | | <!-- |
| | | maxElementsInMemory="10000" //Cache中最多允许保存的数据对象的数量 |
| | | external="false" //缓存中对象是否为永久的,如果是,超时设置将被忽略,对象从不过期 |
| | | timeToLiveSeconds="3600" //缓存的存活时间,从开始创建的时间算起 |
| | | timeToIdleSeconds="3600" //多长时间不访问该缓存,那么ehcache 就会清除该缓存 |
| | | |
| | | 这两个参数很容易误解,看文档根本没用,我仔细分析了ehcache的代码。结论如下: |
| | | 1、timeToLiveSeconds的定义是:以创建时间为基准开始计算的超时时长; |
| | | 2、timeToIdleSeconds的定义是:在创建时间和最近访问时间中取出离现在最近的时间作为基准计算的超时时长; |
| | | 3、如果仅设置了timeToLiveSeconds,则该对象的超时时间=创建时间+timeToLiveSeconds,假设为A; |
| | | 4、如果没设置timeToLiveSeconds,则该对象的超时时间=min(创建时间,最近访问时间)+timeToIdleSeconds,假设为B; |
| | | 5、如果两者都设置了,则取出A、B最少的值,即min(A,B),表示只要有一个超时成立即算超时。 |
| | | |
| | | overflowToDisk="true" //内存不足时,是否启用磁盘缓存 |
| | | diskSpoolBufferSizeMB //设置DiskStore(磁盘缓存)的缓存区大小。默认是30MB。每个Cache都应该有自己的一个缓冲区 |
| | | maxElementsOnDisk //硬盘最大缓存个数 |
| | | diskPersistent //是否缓存虚拟机重启期数据The default value is false |
| | | diskExpiryThreadIntervalSeconds //磁盘失效线程运行时间间隔,默认是120秒。 |
| | | memoryStoreEvictionPolicy="LRU" //当达到maxElementsInMemory限制时,Ehcache将会根据指定的策略去清理内存。默认策略是LRU(最近最少使用)。你可以设置为FIFO(先进先出)或是LFU(较少使用)。 |
| | | clearOnFlush //内存数量最大时是否清除 |
| | | maxEntriesLocalHeap="0" //堆内存中最大缓存对象数,0没有限制 |
| | | maxEntriesLocalDisk="1000" //硬盘最大缓存个数。 |
| | | --> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,比如: 如果设置为WARN,则低于WARN的信息都不会输出 --> |
| | | <!-- scan:当此属性设置为true时,配置文档如果发生改变,将会被重新加载,默认值为true --> |
| | | <!-- scanPeriod:设置监测配置文档是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 --> |
| | | <!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 --> |
| | | <configuration scan="true" scanPeriod="10 seconds"> |
| | | <contextName>logback</contextName> |
| | | |
| | | <!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义后,可以使“${}”来使用变量。 --> |
| | | <!--<property name="log.path" value="/usr/local/server/logs"/>--> |
| | | <property name="log.path" value="d:/logs/user"/> |
| | | |
| | | <!--0. 日志格式和颜色渲染 --> |
| | | <!-- 彩色日志依赖的渲染类 --> |
| | | <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" /> |
| | | <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" /> |
| | | <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" /> |
| | | <!-- 彩色日志格式 --> |
| | | <property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> |
| | | |
| | | <!--1. 输出到控制台--> |
| | | <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
| | | <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> |
| | | <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
| | | <level>debug</level> |
| | | </filter> |
| | | <encoder> |
| | | <Pattern>${CONSOLE_LOG_PATTERN}</Pattern> |
| | | <!-- 设置字符集 --> |
| | | <charset>UTF-8</charset> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <!--2. 输出到文档--> |
| | | <!-- 2.1 level为 DEBUG 日志,时间滚动输出 --> |
| | | <appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/debug.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 日志归档 --> |
| | | <fileNamePattern>${log.path}/${artifactId}/%d{yyyy-MM-dd}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录debug级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>debug</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 2.2 level为 INFO 日志,时间滚动输出 --> |
| | | <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/info.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 每天日志归档路径以及格式 --> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录info级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>info</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 2.3 level为 WARN 日志,时间滚动输出 --> |
| | | <appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/warn.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 此处设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录warn级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>warn</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 2.4 level为 ERROR 日志,时间滚动输出 --> |
| | | <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/error.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 此处设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录ERROR级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>ERROR</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 2.5 所有 除了DEBUG级别的其它高于DEBUG的 日志,记录到一个文件 --> |
| | | <appender name="ALL_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/all.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 此处设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/all-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档记录除了DEBUG级别的其它高于DEBUG的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>DEBUG</level> |
| | | <onMatch>DENY</onMatch> |
| | | <onMismatch>ACCEPT</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- |
| | | <logger>用来设置某一个包或者具体的某一个类的日志打印级别、 |
| | | 以及指定<appender>。<logger>仅有一个name属性, |
| | | 一个可选的level和一个可选的addtivity属性。 |
| | | name:用来指定受此logger约束的某一个包或者具体的某一个类。 |
| | | level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, |
| | | 还有一个特殊值INHERITED或者同义词NULL,代表强制执行上级的级别。 |
| | | 如果未设置此属性,那么当前logger将会继承上级的级别。 |
| | | addtivity:是否向上级logger传递打印信息。默认是true。 |
| | | <logger name="org.springframework.web" level="info"/> |
| | | <logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/> |
| | | --> |
| | | |
| | | <!-- |
| | | root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性 |
| | | level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, |
| | | 不能设置为INHERITED或者同义词NULL。默认是DEBUG |
| | | 可以包含零个或多个元素,标识这个appender将会添加到这个logger。 |
| | | --> |
| | | |
| | | <!-- 4 最终的策略: |
| | | 基本策略(root级) + 根据profile在启动时, logger标签中定制化package日志级别(优先级高于上面的root级)--> |
| | | <springProfile name="dev"> |
| | | <root level="info"> |
| | | <appender-ref ref="CONSOLE" /> |
| | | <appender-ref ref="DEBUG_FILE" /> |
| | | <appender-ref ref="INFO_FILE" /> |
| | | <appender-ref ref="WARN_FILE" /> |
| | | <appender-ref ref="ERROR_FILE" /> |
| | | <appender-ref ref="ALL_FILE" /> |
| | | </root> |
| | | <logger name="ServiceLog" level="debug"/> |
| | | <logger name="com.supersavedriving.user.modular.system.dao" level="debug"/> |
| | | </springProfile> |
| | | |
| | | <springProfile name="fat"> |
| | | <root level="info"> |
| | | <appender-ref ref="CONSOLE" /> |
| | | <appender-ref ref="DEBUG_FILE" /> |
| | | <appender-ref ref="INFO_FILE" /> |
| | | <appender-ref ref="WARN_FILE" /> |
| | | <appender-ref ref="ERROR_FILE" /> |
| | | <appender-ref ref="ALL_FILE" /> |
| | | </root> |
| | | <logger name="ServiceLog" level="debug"/> |
| | | <logger name="com.supersavedriving.user.modular.system.dao" level="debug"/> |
| | | </springProfile> |
| | | |
| | | <springProfile name="produce"> |
| | | <root level="info"> |
| | | <!-- 生产环境最好不配置console写文件 --> |
| | | <appender-ref ref="DEBUG_FILE" /> |
| | | <appender-ref ref="INFO_FILE" /> |
| | | <appender-ref ref="WARN_FILE" /> |
| | | <appender-ref ref="ERROR_FILE" /> |
| | | <appender-ref ref="ALL_FILE" /> |
| | | </root> |
| | | <logger name="ServiceLog" level="debug"/> |
| | | <logger name="com.supersavedriving.user.modular.system.dao" level="debug"/> |
| | | </springProfile> |
| | | |
| | | </configuration> |
New file |
| | |
| | | #redisÅäÖÿªÊ¼ |
| | | # RedisÊý¾Ý¿âË÷Òý£¨Ä¬ÈÏΪ0£© |
| | | spring.redis.database=0 |
| | | # Redis·þÎñÆ÷µØÖ· |
| | | spring.redis.host=127.0.0.1 |
| | | # Redis·þÎñÆ÷Á¬½Ó¶Ë¿Ú |
| | | spring.redis.port=6379 |
| | | # Redis·þÎñÆ÷Á¬½ÓÃÜÂ루ĬÈÏΪ¿Õ£© |
| | | spring.redis.password=123456 |
| | | #spring.redis.password= |
| | | # Á¬½Ó³Ø×î´óÁ¬½ÓÊý£¨Ê¹ÓøºÖµ±íʾûÓÐÏÞÖÆ£© |
| | | spring.redis.jedis.pool.max-active=1024 |
| | | # Á¬½Ó³Ø×î´ó×èÈûµÈ´ýʱ¼ä£¨Ê¹ÓøºÖµ±íʾûÓÐÏÞÖÆ£© |
| | | spring.redis.jedis.pool.max-wait=10000 |
| | | # Á¬½Ó³ØÖеÄ×î´ó¿ÕÏÐÁ¬½Ó |
| | | spring.redis.jedis.pool.max-idle=200 |
| | | # Á¬½Ó³ØÖеÄ×îС¿ÕÏÐÁ¬½Ó |
| | | spring.redis.jedis.pool.min-idle=0 |
| | | # Á¬½Ó³¬Ê±Ê±¼ä£¨ºÁÃ룩 |
| | | spring.redis.timeout=10000 |
| | | #redisÅäÖýáÊø |
| | | spring.redis.block-when-exhausted=true |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html> |
| | | |
| | | <head> |
| | | |
| | | <meta charset="utf-8"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| | | |
| | | |
| | | <title>Guns - 404 页面</title> |
| | | <link rel="shortcut icon" href="${ctxPath}/static/favicon.ico"> <link href="${ctxPath}/static/css/bootstrap.min.css?v=3.3.6" rel="stylesheet"> |
| | | <link href="${ctxPath}/static/css/font-awesome.css?v=4.4.0" rel="stylesheet"> |
| | | <link href="${ctxPath}/static/css/style.css?v=4.1.0" rel="stylesheet"> |
| | | |
| | | </head> |
| | | |
| | | <body class="gray-bg"> |
| | | |
| | | |
| | | <div class="middle-box text-center"> |
| | | <h1>404</h1> |
| | | <h3 class="font-bold">页面未找到!</h3> |
| | | |
| | | <div class="error-desc"> |
| | | 抱歉,页面好像去火星了~ |
| | | <form class="form-inline m-t" role="form"> |
| | | <div class="form-group"> |
| | | <input type="email" class="form-control" placeholder="请输入您需要查找的内容 …"> |
| | | </div> |
| | | <button type="submit" class="btn btn-primary">搜索</button> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 全局js --> |
| | | <script src="${ctxPath}/static/js/jquery.min.js?v=2.1.4"></script> |
| | | <script src="${ctxPath}/static/js/bootstrap.min.js?v=3.3.6"></script> |
| | | |
| | | </body> |
| | | |
| | | </html> |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="container-fluid" style="padding: 0 !important;"> |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | @for(notice in noticeList){ |
| | | <div class="alert alert-success alert-dismissable"> |
| | | <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button> |
| | | ${notice.content} |
| | | </div> |
| | | @} |
| | | </div> |
| | | </div> |
| | | </div> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row" xmlns=""> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>代码生成</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="form-horizontal" id="generate"> |
| | | <div class="row"> |
| | | <div class="col-sm-4"> |
| | | <#input id="projectPath" name="项目路径" value="${params.projectPath}"/> |
| | | </div> |
| | | <div class="col-sm-4"> |
| | | <#input id="projectPackage" name="项目的包" value="${params.projectPackage}"/> |
| | | </div> |
| | | <div class="col-sm-4"> |
| | | <#input id="corePackage" name="核心包" value="${params.corePackage}"/> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#input id="author" name="作者" value="${params.author!}"/> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#input id="bizName" name="业务名称" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#input id="moduleName" name="模块名称" value="${params.moduleName}"/> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#input id="parentMenuName" name="父级菜单名称" underline="false" value="${params.parentMenuName}" |
| | | hidden="pid" readonly="readonly" |
| | | clickFun="Code.showMenuSelectTree(); return false;" |
| | | style="background-color: #ffffff !important;" |
| | | selectFlag="true" selectId="pcodeTreeDiv" selectTreeId="pcodeTree" selectStyle=""/> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#input id="tableName" name="表名称" disabled="disabled"/> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#input id="ignoreTabelPrefix" name="表前缀" value="${params.ignoreTabelPrefix}"/> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#input id="className" name="类名" disabled="disabled"/> |
| | | </div> |
| | | </div> |
| | | <div class="row"> |
| | | <div class="col-sm-6"> |
| | | <button id="genBtn" type="button" class="btn btn-primary mr10" |
| | | onclick="Code.generate()"> |
| | | <span style="padding: 5px 20px;">生成</span> |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div style="padding-top: 10px; overflow: hidden" |
| | | class="container-fluid"> |
| | | <div class="col-md-12"> |
| | | <div class="row admin-form"> |
| | | <div class="col-md-3 col-md-offset-3"> |
| | | <h2>数据表</h2> |
| | | <div class="list-group" id="tableList" |
| | | data-bind="foreach: tables" |
| | | style="height: 500px; overflow-y: scroll"> |
| | | @for(table in tables!){ |
| | | <a href="javascript:void(0)" class="list-group-item" tableName="${table.tableName}" onclick="Code.selectTable('${table.tableName}')">${table.tableName}-${table.tableComment}</a> |
| | | @} |
| | | </div> |
| | | </div> |
| | | <div class="col-md-3"> |
| | | <span><h2>模板</h2></span> |
| | | <div class="list-group" id="templateList" |
| | | style="height: 500px; overflow-y: scroll"> |
| | | @for(template in templates!){ |
| | | <a href="javascript:void(0)" class="list-group-item" key="${template.key}" onclick="Code.selectTemplate('${template.key}')">${template.desc}</a> |
| | | @} |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <ul class="nav nav-list"> |
| | | <li class="divider"></li> |
| | | </ul> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/js/common/select-list-object.js"></script> |
| | | <script src="${ctxPath}/static/modular/code/gen.js"></script> |
| | | @} |
| | | |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html> |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| | | <meta name="renderer" content="webkit"/><!-- 让360浏览器默认选择webkit内核 --> |
| | | |
| | | <!-- 全局css --> |
| | | <link rel="shortcut icon" href="${ctxPath}/static/favicon.ico"> |
| | | <link href="${ctxPath}/static/css/bootstrap.min.css?v=3.3.6" rel="stylesheet"> |
| | | <link href="${ctxPath}/static/css/font-awesome.css?v=4.4.0" rel="stylesheet"> |
| | | <link href="${ctxPath}/static/css/plugins/chosen/chosen.css" rel="stylesheet"> |
| | | <link href="${ctxPath}/static/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet"> |
| | | <link href="${ctxPath}/static/css/plugins/validate/bootstrapValidator.min.css" rel="stylesheet"> |
| | | <link href="${ctxPath}/static/css/style.css?v=4.1.0" rel="stylesheet"> |
| | | <link href="${ctxPath}/static/css/_fstyle.css" rel="stylesheet"> |
| | | <link href="${ctxPath}/static/css/plugins/iCheck/custom.css" rel="stylesheet"> |
| | | <link href="${ctxPath}/static/css/plugins/webuploader/webuploader.css" rel="stylesheet"> |
| | | <link href="${ctxPath}/static/css/plugins/ztree/zTreeStyle.css" rel="stylesheet"> |
| | | <link href="${ctxPath}/static/css/plugins/bootstrap-treetable/bootstrap-treetable.css" rel="stylesheet"/> |
| | | <!-- <link href="${ctxPath}/static/css/plugins/ztree/demo.css" rel="stylesheet"> --> |
| | | |
| | | <!-- 全局js --> |
| | | <script src="${ctxPath}/static/js/jquery.min.js?v=2.1.4"></script> |
| | | <script src="${ctxPath}/static/js/bootstrap.min.js?v=3.3.6"></script> |
| | | <script src="${ctxPath}/static/js/plugins/ztree/jquery.ztree.all.min.js"></script> |
| | | <script src="${ctxPath}/static/js/plugins/bootstrap-table/bootstrap-table.min.js"></script> |
| | | <script src="${ctxPath}/static/js/plugins/validate/bootstrapValidator.min.js"></script> |
| | | <script src="${ctxPath}/static/js/plugins/validate/zh_CN.js"></script> |
| | | <script src="${ctxPath}/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script> |
| | | <script src="${ctxPath}/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script> |
| | | <script src="${ctxPath}/static/js/plugins/bootstrap-treetable/bootstrap-treetable.js"></script> |
| | | <script src="${ctxPath}/static/js/plugins/layer/layer.js"></script> |
| | | <script src="${ctxPath}/static/js/plugins/chosen/chosen.jquery.js"></script> |
| | | <script src="${ctxPath}/static/js/plugins/iCheck/icheck.min.js"></script> |
| | | <script src="${ctxPath}/static/js/plugins/laydate/laydate.js"></script> |
| | | <script src="${ctxPath}/static/js/plugins/webuploader/webuploader.min.js"></script> |
| | | <script src="${ctxPath}/static/js/common/ajax-object.js"></script> |
| | | <script src="${ctxPath}/static/js/common/bootstrap-table-object.js"></script> |
| | | <script src="${ctxPath}/static/js/common/tree-table-object.js"></script> |
| | | <script src="${ctxPath}/static/js/common/web-upload-object.js"></script> |
| | | <script src="${ctxPath}/static/js/common/ztree-object.js"></script> |
| | | <script src="${ctxPath}/static/js/common/Feng.js"></script> |
| | | |
| | | <style type="text/css"> |
| | | table{ |
| | | width:100px; |
| | | table-layout:fixed;/* 只有定义了表格的布局算法为fixed,下面td的定义才能起作用。 */ |
| | | } |
| | | td{ |
| | | width:100%; |
| | | word-break:keep-all;/* 不换行 */ |
| | | white-space:nowrap;/* 不换行 */ |
| | | overflow:hidden;/* 内容超出宽度时隐藏超出部分的内容 */ |
| | | text-overflow:ellipsis;/* 当对象内文本溢出时显示省略标记(...) ;需与overflow:hidden;一起使用*/ |
| | | } |
| | | </style> |
| | | |
| | | <script type="text/javascript"> |
| | | Feng.addCtx("${ctxPath}"); |
| | | Feng.sessionTimeoutRegistry(); |
| | | </script> |
| | | </head> |
| | | |
| | | <body class="gray-bg"> |
| | | <div class="wrapper wrapper-content"> |
| | | ${layoutContent} |
| | | </div> |
| | | <script src="${ctxPath}/static/js/content.js?v=1.0.0"></script> |
| | | </body> |
| | | </html> |
New file |
| | |
| | | <div id="page-wrapper" class="gray-bg dashbard-1"> |
| | | <div class="row border-bottom"> |
| | | <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0"> |
| | | <div class="navbar-header"><a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a> |
| | | <form role="search" class="navbar-form-custom" method="post" action="search_results.html"> |
| | | <div class="form-group"> |
| | | <input type="text" placeholder="请输入您需要查找的内容 …" class="form-control" name="top-search" id="top-search"> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | <ul class="nav navbar-top-links navbar-right"> |
| | | <li class="dropdown hidden-xs"> |
| | | <a class="right-sidebar-toggle" aria-expanded="false"> |
| | | <i class="fa fa-tasks"></i> 主题 |
| | | </a> |
| | | </li> |
| | | </ul> |
| | | </nav> |
| | | </div> |
| | | <div class="row content-tabs"> |
| | | <button class="roll-nav roll-left J_tabLeft"><i class="fa fa-backward"></i> |
| | | </button> |
| | | <nav class="page-tabs J_menuTabs"> |
| | | <div class="page-tabs-content"> |
| | | <a href="javascript:;" class="active J_menuTab" data-id="${ctxPath}/blackboard">首页</a> |
| | | </div> |
| | | </nav> |
| | | <button class="roll-nav roll-right J_tabRight"><i class="fa fa-forward"></i> |
| | | </button> |
| | | <div class="btn-group roll-nav roll-right"> |
| | | <button class="dropdown J_tabClose" data-toggle="dropdown">关闭操作<span class="caret"></span> |
| | | |
| | | </button> |
| | | <ul role="menu" class="dropdown-menu dropdown-menu-right"> |
| | | <li class="J_tabShowActive"><a>定位当前选项卡</a> |
| | | </li> |
| | | <li class="divider"></li> |
| | | <li class="J_tabCloseAll"><a>关闭全部选项卡</a> |
| | | </li> |
| | | <li class="J_tabCloseOther"><a>关闭其他选项卡</a> |
| | | </li> |
| | | </ul> |
| | | </div> |
| | | <a href="logout" class="roll-nav roll-right J_tabExit"><i class="fa fa fa-sign-out"></i> 退出</a> |
| | | </div> |
| | | <div class="row J_mainContent" id="content-main"> |
| | | <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="${ctxPath}/blackboard" frameborder="0" data-id="${ctxPath}/blackboard" seamless></iframe> |
| | | </div> |
| | | <div class="footer"> |
| | | <div class="pull-right">© 2016-2017 <a href="http://git.oschina.net/naan1993/guns" target="_blank">guns</a> |
| | | </div> |
| | | </div> |
| | | </div> |
New file |
| | |
| | | <nav class="navbar-default navbar-static-side" role="navigation"> |
| | | <div class="nav-close"><i class="fa fa-times-circle"></i> |
| | | </div> |
| | | <div class="sidebar-collapse"> |
| | | <ul class="nav" id="side-menu"> |
| | | <li class="nav-header"> |
| | | <div class="dropdown profile-element"> |
| | | <span><img alt="image" class="img-circle" |
| | | @if(isEmpty(avatar)){ |
| | | src="${ctxPath}/static/img/girl.gif" |
| | | @}else{ |
| | | src="${ctxPath}/kaptcha/${avatar}" |
| | | @} |
| | | width="64px" height="64px"/></span> |
| | | <a data-toggle="dropdown" class="dropdown-toggle" href="#"> |
| | | <span class="clear"> |
| | | <span class="block m-t-xs"><strong class="font-bold">${shiro.getUser().name}</strong></span> |
| | | <span class="text-muted text-xs block">${shiro.getUser().roleNames[0]}<b class="caret"></b></span> |
| | | </span> |
| | | </a> |
| | | <ul class="dropdown-menu m-t-xs"> |
| | | <li><a class="J_menuItem" href="${ctxPath}/mgr/user_info">个人资料</a></li> |
| | | <li><a class="J_menuItem" href="${ctxPath}/mgr/user_chpwd">修改密码</a></li> |
| | | <li class="divider"></li> |
| | | <li><a href="${ctxPath}/logout">安全退出</a> |
| | | </li> |
| | | </ul> |
| | | </div> |
| | | <div class="logo-element">GS |
| | | </div> |
| | | </li> |
| | | |
| | | @for(title in titles){ |
| | | @if(tool.isEmpty(title.children)){ |
| | | <li> |
| | | <a class="J_menuItem" href="${ctxPath}${title.url}" name="tabMenuItem"> |
| | | <i class="fa ${title.icon}"></i> |
| | | <span class="nav-label">${title.name}</span> |
| | | </a> |
| | | </li> |
| | | @}else{ |
| | | <li> |
| | | <a href="#"> |
| | | <i class="fa ${title.icon}"></i> |
| | | <span class="nav-label">${title.name}</span> |
| | | <span class="fa arrow"></span> |
| | | </a> |
| | | <ul class="nav nav-second-level"> |
| | | @for(subTitle in title.children){ |
| | | @if(tool.isEmpty(subTitle.children)){ |
| | | <li> |
| | | <a class="J_menuItem" href="${ctxPath}${subTitle.url}" name="tabMenuItem">${subTitle.name}</a> |
| | | </li> |
| | | @}else{ |
| | | <li> |
| | | <a href="#">${subTitle.name} <span class="fa arrow"></span></a> |
| | | <ul class="nav nav-third-level"> |
| | | @for(thirdTitle in subTitle.children){ |
| | | <li> |
| | | <a class="J_menuItem" href="${ctxPath}${thirdTitle.url}" name="tabMenuItem">${thirdTitle.name}</a> |
| | | </li> |
| | | @} |
| | | </ul> |
| | | </li> |
| | | @} |
| | | @} |
| | | </ul> |
| | | </li> |
| | | @} |
| | | @} |
| | | |
| | | </ul> |
| | | </div> |
| | | </nav> |
New file |
| | |
| | | <div id="right-sidebar"> |
| | | <div class="sidebar-container"> |
| | | |
| | | <ul class="nav nav-tabs navs-3"> |
| | | <li class="active"><a data-toggle="tab" href="#tab-1"> <i |
| | | class="fa fa-gear"></i> 主题 |
| | | </a></li> |
| | | </ul> |
| | | |
| | | <div class="tab-content"> |
| | | <div id="tab-1" class="tab-pane active"> |
| | | <div class="sidebar-title"> |
| | | <h3> |
| | | <i class="fa fa-comments-o"></i> 主题设置 |
| | | </h3> |
| | | <small><i class="fa fa-tim"></i> |
| | | 你可以从这里选择和预览主题的布局和样式,这些设置会被保存在本地,下次打开的时候会直接应用这些设置。</small> |
| | | </div> |
| | | <div class="skin-setttings"> |
| | | <div class="title">主题设置</div> |
| | | <div class="setings-item"> |
| | | <span>收起左侧菜单</span> |
| | | <div class="switch"> |
| | | <div class="onoffswitch"> |
| | | <input type="checkbox" name="collapsemenu" |
| | | class="onoffswitch-checkbox" id="collapsemenu"> <label |
| | | class="onoffswitch-label" for="collapsemenu"> <span |
| | | class="onoffswitch-inner"></span> <span |
| | | class="onoffswitch-switch"></span> |
| | | </label> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="setings-item"> |
| | | <span>固定顶部</span> |
| | | |
| | | <div class="switch"> |
| | | <div class="onoffswitch"> |
| | | <input type="checkbox" name="fixednavbar" |
| | | class="onoffswitch-checkbox" id="fixednavbar"> <label |
| | | class="onoffswitch-label" for="fixednavbar"> <span |
| | | class="onoffswitch-inner"></span> <span |
| | | class="onoffswitch-switch"></span> |
| | | </label> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="setings-item"> |
| | | <span> 固定宽度 </span> |
| | | |
| | | <div class="switch"> |
| | | <div class="onoffswitch"> |
| | | <input type="checkbox" name="boxedlayout" |
| | | class="onoffswitch-checkbox" id="boxedlayout"> <label |
| | | class="onoffswitch-label" for="boxedlayout"> <span |
| | | class="onoffswitch-inner"></span> <span |
| | | class="onoffswitch-switch"></span> |
| | | </label> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="title">皮肤选择</div> |
| | | <div class="setings-item default-skin nb"> |
| | | <span class="skin-name "> <a href="#" class="s-skin-0"> |
| | | 默认皮肤 </a> |
| | | </span> |
| | | </div> |
| | | <div class="setings-item blue-skin nb"> |
| | | <span class="skin-name "> <a href="#" class="s-skin-1"> |
| | | 蓝色主题 </a> |
| | | </span> |
| | | </div> |
| | | <div class="setings-item yellow-skin nb"> |
| | | <span class="skin-name "> <a href="#" class="s-skin-3"> |
| | | 黄色/紫色主题 </a> |
| | | </span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
New file |
| | |
| | | @/* |
| | | 名称查询条件标签的参数说明: |
| | | |
| | | name : 查询条件的名称 |
| | | id : 查询内容的input框id |
| | | @*/ |
| | | <div class="input-group"> |
| | | <div class="input-group-btn"> |
| | | <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" |
| | | type="button">${name} |
| | | </button> |
| | | </div> |
| | | <input type="text" class="form-control" id="${id}" placeholder="${placeholder!}" /> |
| | | </div> |
New file |
| | |
| | | @/* |
| | | 选择查询条件标签的参数说明: |
| | | |
| | | name : 查询条件的名称 |
| | | id : 查询内容的input框id |
| | | @*/ |
| | | <div class="input-group"> |
| | | <div class="input-group-btn"> |
| | | <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button"> |
| | | ${name} |
| | | </button> |
| | | </div> |
| | | <select class="form-control" id="${id}"> |
| | | ${tagBody!} |
| | | </select> |
| | | </div> |
New file |
| | |
| | | @/* |
| | | 时间查询条件标签的参数说明: |
| | | |
| | | name : 查询条件的名称 |
| | | id : 查询内容的input框id |
| | | isTime : 日期是否带有小时和分钟(true/false) |
| | | @*/ |
| | | <div class="input-group"> |
| | | <div class="input-group-btn"> |
| | | <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" |
| | | type="button">${name} |
| | | </button> |
| | | </div> |
| | | <input type="text" class="form-control layer-date" id="${id}"/> |
| | | </div> |
New file |
| | |
| | | @/* |
| | | 头像参数的说明: |
| | | name : 名称 |
| | | id : 头像的id |
| | | @*/ |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label head-scu-label">${name}</label> |
| | | <div class="col-sm-4"> |
| | | <div id="${id}PreId"> |
| | | <div><img width="100px" height="100px" |
| | | @if(isEmpty(avatarImg)){ |
| | | src="${ctxPath}/static/img/girl.gif"></div> |
| | | @}else{ |
| | | src="${ctxPath}/kaptcha/${avatarImg}"></div> |
| | | @} |
| | | </div> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <div class="head-scu-btn upload-btn" id="${id}BtnId"> |
| | | <i class="fa fa-upload"></i> 上传 |
| | | </div> |
| | | </div> |
| | | <input type="hidden" id="${id}" value="${avatarImg!}"/> |
| | | </div> |
| | | @if(isNotEmpty(underline) && underline == 'true'){ |
| | | <div class="hr-line-dashed"></div> |
| | | @} |
| | | |
| | | |
New file |
| | |
| | | @/* |
| | | 按钮标签中各个参数的说明: |
| | | |
| | | btnType : 按钮的类型决定了颜色(default-灰色,primary-绿色,success-蓝色,info-淡蓝色,warning-黄色,danger-红色,white-白色) |
| | | space : 按钮左侧是否有间隔(true/false) |
| | | clickFun : 点击按钮所执行的方法 |
| | | icon : 按钮上的图标的样式 |
| | | name : 按钮名称 |
| | | @*/ |
| | | |
| | | @var spaceCss = ""; |
| | | @var btnType = ""; |
| | | @if(isEmpty(space) || space == "false"){ |
| | | @ spaceCss = ""; |
| | | @}else{ |
| | | @ spaceCss = "button-margin"; |
| | | @} |
| | | @if(isEmpty(btnCss)){ |
| | | @ btnType = "primary"; |
| | | @}else{ |
| | | @ btnType = btnCss; |
| | | @} |
| | | <button type="button" class="btn btn-${btnType} ${spaceCss}" onclick="${clickFun!}" id="${id!}"> |
| | | <i class="fa ${icon}"></i> ${name} |
| | | </button> |
| | | |
New file |
| | |
| | | @/* |
| | | 表单中input框标签中各个参数的说明: |
| | | |
| | | hidden : input hidden框的id |
| | | id : input框id |
| | | name : input框名称 |
| | | readonly : readonly属性 |
| | | clickFun : 点击事件的方法名 |
| | | style : 附加的css属性 |
| | | @*/ |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">${name}</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="${id}" name="${id}" |
| | | @if(isNotEmpty(value)){ |
| | | value="${tool.dateType(value)}" |
| | | @} |
| | | @if(isNotEmpty(type)){ |
| | | type="${type}" |
| | | @}else{ |
| | | type="text" |
| | | @} |
| | | @if(isNotEmpty(readonly)){ |
| | | readonly="${readonly}" |
| | | @} |
| | | @if(isNotEmpty(clickFun)){ |
| | | onclick="${clickFun}" |
| | | @} |
| | | @if(isNotEmpty(style)){ |
| | | style="${style}" |
| | | @} |
| | | @if(isNotEmpty(disabled)){ |
| | | disabled="${disabled}" |
| | | @} |
| | | > |
| | | @if(isNotEmpty(hidden)){ |
| | | <input class="form-control" type="hidden" id="${hidden}" value="${hiddenValue!}"> |
| | | @} |
| | | |
| | | @if(isNotEmpty(selectFlag)){ |
| | | <div id="${selectId}" style="display: none; position: absolute; z-index: 200;"> |
| | | <ul id="${selectTreeId}" class="ztree tree-box" style="${selectStyle!}"></ul> |
| | | </div> |
| | | @} |
| | | </div> |
| | | </div> |
| | | @if(isNotEmpty(underline) && underline == 'true'){ |
| | | <div class="hr-line-dashed"></div> |
| | | @} |
| | | |
| | | |
New file |
| | |
| | | @/* |
| | | select标签中各个参数的说明: |
| | | name : select的名称 |
| | | id : select的id |
| | | underline : 是否带分割线 |
| | | @*/ |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">${name}</label> |
| | | <div class="col-sm-9"> |
| | | <select class="form-control" id="${id}" name="${id}"> |
| | | ${tagBody!} |
| | | </select> |
| | | @if(isNotEmpty(hidden)){ |
| | | <input class="form-control" type="hidden" id="${hidden}" value="${hiddenValue!}"> |
| | | @} |
| | | </div> |
| | | </div> |
| | | @if(isNotEmpty(underline) && underline == 'true'){ |
| | | <div class="hr-line-dashed"></div> |
| | | @} |
| | | |
| | | |
New file |
| | |
| | | @/* |
| | | 表格标签的参数说明: |
| | | |
| | | id : table表格的id |
| | | @*/ |
| | | <table id="${id}" data-mobile-responsive="true" data-click-to-select="true"> |
| | | <thead> |
| | | <tr> |
| | | <th data-field="selectItem" data-checkbox="true"></th> |
| | | </tr> |
| | | </thead> |
| | | </table> |
New file |
| | |
| | | 1 dictSelector(字典选择器) |
| | | 此标签是为了方便在前台form表单中使用系统中维护的字典而开发的,具体说明如下: |
| | | 1.1 标签样例 |
| | | <#dictSelector id="sex" name ="sex" code="sys_sex" readonly="readonly" label="性别" underline="true" value="${user.sex}" /> |
| | | 1.2 属性说明 |
| | | id: (非必须) 控件的id |
| | | name: (非必须) 控件的name |
| | | code:(必须) 字典类型编码,根据code的值去后台查询该类型的字典。 |
| | | type:(非必须) 控件类型,可选项为[select,radio,checkbox],标签会根据填写的类型,生成不同的控件。 |
| | | searchnum:(非必须)下拉框达到多少个,开启搜索框,默认10个,type为select起效。 |
| | | label:(非必须) 字典属性名称 |
| | | width:(非必须) 控件的宽度单位为px,type为select起效。 |
| | | value: (非必须) 控件默认值,多选时值要用,分隔。 |
| | | placeholder:(非必须) 控件提示信息,type为select起效。 |
| | | multiple:(非必须) 是否开启多选,可选值[true,false],默认为false,type为select起效。 |
| | | underline:(非必须) 是否显示分割线,可选值[true,false],默认为false。 |
| | | onchange:(非必须) onchange事件方法名称,会传入更改后的值作为参数,例:onchange="myOnChange" function myOnChange(newVal){}。 |
| | | readonly:(非必须)只读控件,可选值[true,false],默认false |
| | | disabled:(非必须) 禁用控件,可选值[true,false],默认false |
| | | |
| | | |
| | | |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html> |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| | | <meta name="renderer" content="webkit"> |
| | | <title>Guns - 主页</title> |
| | | <link rel="shortcut icon" href="${ctxPath}/static/favicon.ico"> |
| | | <link href="${ctxPath}/static/css/bootstrap.min.css?v=3.3.6" rel="stylesheet"> |
| | | <link href="${ctxPath}/static/css/font-awesome.min.css?v=4.4.0" rel="stylesheet"> |
| | | <link href="${ctxPath}/static/css/style.css?v=4.1.0" rel="stylesheet"> |
| | | </head> |
| | | |
| | | <body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden"> |
| | | <div id="wrapper"> |
| | | |
| | | <!--左侧导航开始--> |
| | | @include("/common/_tab.html"){} |
| | | <!--左侧导航结束--> |
| | | |
| | | <!--右侧部分开始--> |
| | | @include("/common/_right.html"){} |
| | | <!--右侧部分结束--> |
| | | |
| | | <!--右侧边栏开始--> |
| | | @include("/common/_theme.html"){} |
| | | <!--右侧边栏结束--> |
| | | |
| | | </div> |
| | | |
| | | <!-- 全局js --> |
| | | <script src="${ctxPath}/static/js/jquery.min.js?v=2.1.4"></script> |
| | | <script src="${ctxPath}/static/js/bootstrap.min.js?v=3.3.6"></script> |
| | | <script src="${ctxPath}/static/js/plugins/metisMenu/jquery.metisMenu.js"></script> |
| | | <script src="${ctxPath}/static/js/plugins/slimscroll/jquery.slimscroll.min.js"></script> |
| | | <script src="${ctxPath}/static/js/plugins/layer/layer.js"></script> |
| | | |
| | | <!-- 自定义js --> |
| | | <script src="${ctxPath}/static/js/hplus.js?v=4.1.0"></script> |
| | | <script type="text/javascript" src="${ctxPath}/static/js/contabs.js"></script> |
| | | |
| | | <!-- 第三方插件 --> |
| | | <script src="${ctxPath}/static/js/plugins/pace/pace.min.js"></script> |
| | | |
| | | </body> |
| | | |
| | | </html> |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html> |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| | | |
| | | <title>Guns - 登录</title> |
| | | |
| | | <link rel="shortcut icon" href="${ctxPath}/static/favicon.ico"> |
| | | <link href="${ctxPath}/static/css/bootstrap.min.css?v=3.3.6" rel="stylesheet"> |
| | | <link href="${ctxPath}/static/css/font-awesome.css?v=4.4.0" rel="stylesheet"> |
| | | <link href="${ctxPath}/static/css/style.css?v=4.1.0" rel="stylesheet"> |
| | | <script>if (window.top !== window.self) { |
| | | window.top.location = window.location; |
| | | }</script> |
| | | <script src="${ctxPath}/static/js/jquery.min.js?v=2.1.4"></script> |
| | | <script src="${ctxPath}/static/js/bootstrap.min.js?v=3.3.6"></script> |
| | | </head> |
| | | |
| | | <body class="gray-bg"> |
| | | |
| | | <div class="middle-box text-center loginscreen"> |
| | | <div style="padding: 100px 0px;"> |
| | | <div> |
| | | <h1 class="logo-name">GS</h1> |
| | | </div> |
| | | <h3>欢迎使用 Guns</h3> |
| | | <br/> |
| | | <h4 style="color: red;">${tips!}</h4> |
| | | <form class="m-t" role="form" action="${ctxPath}/login" method="post"> |
| | | <div class="form-group"> |
| | | <input type="text" name="username" class="form-control" placeholder="用户名" required=""> |
| | | </div> |
| | | <div class="form-group"> |
| | | <input type="password" name="password" class="form-control" placeholder="密码" required=""> |
| | | </div> |
| | | @if(kaptcha.getKaptchaOnOff() == true){ |
| | | <div class="form-group" style="float: left;"> |
| | | <div class="col-sm-8" style="padding-left: 0px; padding-right: 0px;"> |
| | | <input class="form-control" type="text" name="kaptcha" placeholder="验证码" required=""> |
| | | </div> |
| | | <div class="col-sm-4" style="padding-left: 0px; padding-right: 0px;"> |
| | | <img src="${ctxPath}/kaptcha" id="kaptcha" width="100%" height="100%"/> |
| | | </div> |
| | | </div> |
| | | @} |
| | | <div class="form-group" style="float: left;"> |
| | | <div class="checkbox" style="text-align: left"> |
| | | <label> |
| | | <input type="checkbox" name="remember" style="margin-top: 2px;">记住我 |
| | | </label> |
| | | </div> |
| | | </div> |
| | | <button type="submit" class="btn btn-primary block full-width m-b">登 录</button> |
| | | </p> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | |
| | | <script> |
| | | $(function () { |
| | | $("#kaptcha").on('click', function () { |
| | | $("#kaptcha").attr('src', '${ctxPath}/kaptcha?' + Math.floor(Math.random() * 100)).fadeIn(); |
| | | }); |
| | | }); |
| | | </script> |
| | | |
| | | </body> |
| | | |
| | | </html> |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="col-sm-6 col-sm-offset-3"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>代码生成</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">模块英文名称</label> |
| | | <div class="col-sm-10"> |
| | | <input type="text" class="form-control" id="moduleName"> <span class="help-block m-b-none">例如:system</span> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">业务名称</label> |
| | | <div class="col-sm-10"> |
| | | <input type="text" class="form-control" id="bizChName"> <span class="help-block m-b-none">例如:测试</span> |
| | | </div> |
| | | </div> |
| | | <div class="hr-line-dashed"></div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">业务英文名称</label> |
| | | <div class="col-sm-10"> |
| | | <input type="text" class="form-control" id="bizEnName"> <span class="help-block m-b-none">例如:test</span> |
| | | </div> |
| | | </div> |
| | | <div class="hr-line-dashed"></div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">输出路径</label> |
| | | <div class="col-sm-10"> |
| | | <input type="text" class="form-control" id="path"> <span class="help-block m-b-none">默认路径为D:\ideaSpace\guns,可修改为您的项目的路径</span> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div class="col-sm-4 col-sm-offset-2"> |
| | | <button class="btn btn-primary" onclick="Code.generate()">代码生成</button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/code/code.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>部门管理</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="condition" name="名称" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="Dept.search()"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="DeptTableToolbar" role="group"> |
| | | @if(shiro.hasPermission("/dept/add")){ |
| | | <#button name="添加" icon="fa-plus" clickFun="Dept.openAddDept()"/> |
| | | @} |
| | | @if(shiro.hasPermission("/dept/update")){ |
| | | <#button name="修改" icon="fa-plus" clickFun="Dept.openDeptDetail()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/dept/delete")){ |
| | | <#button name="删除" icon="fa-plus" clickFun="Dept.delete()" space="true"/> |
| | | @} |
| | | </div> |
| | | <#table id="DeptTable"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/dept/dept.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="deptInfoForm"> |
| | | |
| | | <input type="hidden" id="id" value=""> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-6 b-r"> |
| | | <#input id="simplename" name="部门名称" underline="true"/> |
| | | |
| | | <#input id="fullname" name="部门全称" underline="true"/> |
| | | |
| | | <#input id="tips" name="备注" underline="true"/> |
| | | </div> |
| | | <div class="col-sm-6"> |
| | | <#input id="num" name="排序" underline="true"/> |
| | | |
| | | <#input id="pName" name="上级部门" readonly="readonly" hidden="pid" |
| | | clickFun="DeptInfoDlg.showDeptSelectTree(); return false;" |
| | | style="background-color: #ffffff !important;"/> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 父级部门的选择框 --> |
| | | <div id="parentDeptMenu" class="menuContent" |
| | | style="display: none; position: absolute; z-index: 200;"> |
| | | <ul id="parentDeptMenuTree" class="ztree tree-box" style="width: 245px !important;"></ul> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="DeptInfoDlg.addSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="DeptInfoDlg.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/dept/dept_info.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="deptInfoForm"> |
| | | |
| | | <input type="hidden" id="id" value="${dept.id}"> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-6 b-r"> |
| | | <#input id="simplename" name="部门名称" underline="true" value="${dept.simplename}"/> |
| | | |
| | | <#input id="fullname" name="部门全称" underline="true" value="${dept.fullname}"/> |
| | | |
| | | <#input id="tips" name="备注" underline="true" value="${dept.tips}"/> |
| | | </div> |
| | | <div class="col-sm-6"> |
| | | <#input id="num" name="排序" underline="true" value="${dept.num}"/> |
| | | |
| | | <#input id="pName" name="上级部门" readonly="readonly" hidden="pid" |
| | | hiddenValue="${dept.pid}" value="${pName}" |
| | | clickFun="DeptInfoDlg.showDeptSelectTree(); return false;" |
| | | style="background-color: #ffffff !important;"/> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 父级部门的选择框 --> |
| | | <div id="parentDeptMenu" class="menuContent" |
| | | style="display: none; position: absolute; z-index: 200;"> |
| | | <ul id="parentDeptMenuTree" class="ztree tree-box" style="width: 245px !important;"></ul> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="DeptInfoDlg.editSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="DeptInfoDlg.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/dept/dept_info.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>字典管理</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="condition" name="名称" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="Dict.search()"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="DictTableToolbar" role="group"> |
| | | @if(shiro.hasPermission("/dict/add")){ |
| | | <#button name="添加" icon="fa-plus" clickFun="Dict.openAddDict()"/> |
| | | @} |
| | | @if(shiro.hasPermission("/dict/update")){ |
| | | <#button name="修改" icon="fa-plus" clickFun="Dict.openDictDetail()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/dict/delete")){ |
| | | <#button name="删除" icon="fa-plus" clickFun="Dict.delete()" space="true"/> |
| | | @} |
| | | </div> |
| | | <#table id="DictTable"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/dict/dict.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal"> |
| | | |
| | | <input type="hidden" id="id" value=""> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-12" id="itemsArea"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">类型编码</label> |
| | | <div class="col-sm-2"> |
| | | <input class="form-control" id="dictCode" type="text"> |
| | | </div> |
| | | <label class="col-sm-2 control-label">类型名称</label> |
| | | <div class="col-sm-2"> |
| | | <input class="form-control" id="dictName" type="text"> |
| | | </div> |
| | | |
| | | <div class="col-sm-2"> |
| | | <#button btnCss="info" name="增加" icon="fa-plus" clickFun="DictInfoDlg.addItem()"/> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">备注</label> |
| | | <div class="col-sm-8"> |
| | | <input class="form-control" id="dictTips" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="hr-line-dashed"></div> |
| | | |
| | | </div> |
| | | </div> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="DictInfoDlg.addSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="DictInfoDlg.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <script type="text/template" id="itemTemplate"> |
| | | <div class="form-group" name="dictItem" id="dictItem"> |
| | | <label class="col-sm-1 control-label">值</label> |
| | | <div class="col-sm-2"> |
| | | <input class="form-control" type="text" name="itemCode"> |
| | | </div> |
| | | <label class="col-sm-1 control-label" >名称</label> |
| | | <div class="col-sm-2"> |
| | | <input class="form-control" type="text" name="itemName"> |
| | | </div> |
| | | <label class="col-sm-1 control-label" >序号</label> |
| | | <div class="col-sm-2"> |
| | | <input class="form-control" type="text" name="itemNum"> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <#button btnCss="danger" name="删除" id="cancel" icon="fa-remove" clickFun="DictInfoDlg.deleteItem(event)"/> |
| | | </div> |
| | | </div> |
| | | </script> |
| | | |
| | | <script src="${ctxPath}/static/modular/system/dict/dict_info.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal"> |
| | | |
| | | <input type="hidden" id="id" value=""> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-12" id="itemsArea"> |
| | | <input type="hidden" id="itemSize" value="${subDicts.~size!0}" /> |
| | | <div class="form-group"> |
| | | |
| | | <label class="col-sm-2 control-label">类型编码</label> |
| | | <div class="col-sm-2"> |
| | | <input class="form-control" id="dictCode" type="text" value="${dict.code}"> |
| | | </div> |
| | | |
| | | <label class="col-sm-2 control-label">类型名称</label> |
| | | <div class="col-sm-2"> |
| | | <input class="form-control" id="dictName" type="text" value="${dict.name}"> |
| | | <input type="hidden" id="dictId" value="${dict.id}"> |
| | | </div> |
| | | |
| | | <div class="col-sm-2"> |
| | | <#button btnCss="info" name="增加" icon="fa-plus" clickFun="DictInfoDlg.addItem()"/> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">备注</label> |
| | | <div class="col-sm-8"> |
| | | <input class="form-control" id="dictTips" type="text" value="${dict.tips}"> |
| | | </div> |
| | | </div> |
| | | <div class="hr-line-dashed"></div> |
| | | @for(item in subDicts){ |
| | | <div class="form-group" name="dictItem" id="dictItem${itemLP.index}"> |
| | | <label class="col-sm-1 control-label">值</label> |
| | | <div class="col-sm-2"> |
| | | <input class="form-control" type="text" name="itemCode" value="${item.code}"> |
| | | </div> |
| | | <label class="col-sm-1 control-label" >名称</label> |
| | | <div class="col-sm-2"> |
| | | <input class="form-control" type="text" name="itemName" value="${item.name}"> |
| | | </div> |
| | | <label class="col-sm-1 control-label" >序号</label> |
| | | <div class="col-sm-2"> |
| | | <input class="form-control" type="text" name="itemNum" value="${item.num}"> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <#button btnCss="danger" name="删除" id="cancel" icon="fa-remove" clickFun="DictInfoDlg.deleteItem(event)"/> |
| | | </div> |
| | | </div> |
| | | @} |
| | | </input> |
| | | </div> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="DictInfoDlg.editSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="DictInfoDlg.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <script type="text/template" id="itemTemplate"> |
| | | <div class="form-group" name="dictItem" id="dictItem"> |
| | | <label class="col-sm-1 control-label">值</label> |
| | | <div class="col-sm-2"> |
| | | <input class="form-control" type="text" name="itemCode"> |
| | | </div> |
| | | <label class="col-sm-1 control-label" >名称</label> |
| | | <div class="col-sm-2"> |
| | | <input class="form-control" type="text" name="itemName"> |
| | | </div> |
| | | <label class="col-sm-1 control-label" >序号</label> |
| | | <div class="col-sm-2"> |
| | | <input class="form-control" type="text" name="itemNum"> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <#button btnCss="danger" name="删除" id="cancel" icon="fa-remove" clickFun="DictInfoDlg.deleteItem(event)"/> |
| | | </div> |
| | | </div> |
| | | </script> |
| | | |
| | | <script src="${ctxPath}/static/modular/system/dict/dict_info.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>业务日志</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="col-sm-2"> |
| | | <#TimeCon id="beginTime" name="开始时间" isTime="false" pattern="YYYY-MM-DD" /> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <#TimeCon id="endTime" name="结束时间" isTime="false" pattern="YYYY-MM-DD" /> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <#NameCon id="logName" name="日志名称" /> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <#SelectCon id="logType" name="日志类型" > |
| | | <option value="0">全部</option> |
| | | <option value="1">业务日志</option> |
| | | <option value="2">异常日志</option> |
| | | </#SelectCon> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <#button name="搜索" icon="fa-search" clickFun="OptLog.search()"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="OptLogTableToolbar" role="group"> |
| | | <#button name="查看详情" icon="fa-plus" clickFun="OptLog.detail()"/> |
| | | @if(shiro.hasPermission("/log/delLog")){ |
| | | <#button name="清空日志" icon="fa-plus" clickFun="OptLog.delLog()" space="true"/> |
| | | @} |
| | | </div> |
| | | <#table id="OptLogTable"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/log/log.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>登录日志</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#TimeCon id="beginTime" name="开始时间" isTime="false" pattern="YYYY-MM-DD" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#TimeCon id="endTime" name="结束时间" isTime="false" pattern="YYYY-MM-DD" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="logName" name="日志名称" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="LoginLog.search()"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="LoginLogTableToolbar" role="group"> |
| | | <#button name="清空日志" icon="fa-plus" clickFun="LoginLog.delLog()"/> |
| | | </div> |
| | | <#table id="LoginLogTable"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/log/login_log.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>菜单管理</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="menuName" name="菜单名称" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="level" name="层级" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="Menu.search()"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="menuTableToolbar" role="group"> |
| | | @if(shiro.hasPermission("/menu/add")){ |
| | | <#button name="添加" icon="fa-plus" clickFun="Menu.openAddMenu()"/> |
| | | @} |
| | | @if(shiro.hasPermission("/menu/edit")){ |
| | | <#button name="修改" icon="fa-edit" clickFun="Menu.openChangeMenu()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/menu/remove")){ |
| | | <#button name="删除" icon="fa-remove" clickFun="Menu.delMenu()" space="true"/> |
| | | @} |
| | | </div> |
| | | <#table id="menuTable"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/menu/menu.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="menuInfoForm"> |
| | | |
| | | <input type="hidden" id="id" value=""> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-6 b-r"> |
| | | <#input id="name" name="名称" underline="true" /> |
| | | <#input id="code" name="菜单编号" underline="true" /> |
| | | <#input id="pcodeName" name="父级编号" underline="true" |
| | | hidden="pcode" readonly="readonly" |
| | | clickFun="MenuInfoDlg.showMenuSelectTree(); return false;" |
| | | style="background-color: #ffffff !important;" |
| | | selectFlag="true" selectId="pcodeTreeDiv" selectTreeId="pcodeTree" selectStyle="width:244px !important;"/> |
| | | <#select id="ismenu" name="是否是菜单"> |
| | | <option value="1">是</option> |
| | | <option value="0">不是</option> |
| | | </#select> |
| | | </div> |
| | | <div class="col-sm-6"> |
| | | <#input id="url" name="请求地址" underline="true" /> |
| | | <#input id="num" name="排序" underline="true" /> |
| | | <#input id="icon" name="图标" underline="false" /> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="MenuInfoDlg.addSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="MenuInfoDlg.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/menu/menu_info.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="menuInfoForm"> |
| | | |
| | | <input type="hidden" id="id" value="${menu.id}"> |
| | | <input type="hidden" id="ismenuValue" value="${menu.ismenu}"> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-6 b-r"> |
| | | <#input id="name" name="名称" value="${menu.name}" underline="true" /> |
| | | <#input id="code" name="菜单编号" value="${menu.code}" underline="true" /> |
| | | <#input id="pcodeName" name="父级编号" value="${menu.pcodeName}" underline="true" |
| | | hidden="pcode" readonly="readonly" hiddenValue="${menu.pcode}" |
| | | clickFun="MenuInfoDlg.showMenuSelectTree(); return false;" |
| | | style="background-color: #ffffff !important;" |
| | | selectFlag="true" selectId="pcodeTreeDiv" selectTreeId="pcodeTree" selectStyle="width:244px !important;"/> |
| | | <#select id="ismenu" name="是否是菜单"> |
| | | <option value="1">是</option> |
| | | <option value="0">不是</option> |
| | | </#select> |
| | | |
| | | </div> |
| | | <div class="col-sm-6"> |
| | | <#input id="url" name="请求地址" value="${menu.url}" underline="true" /> |
| | | <#input id="num" name="排序" value="${menu.num}" underline="true" /> |
| | | <#input id="icon" name="图标" underline="false" value="${menu.icon}"/> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="MenuInfoDlg.editSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="MenuInfoDlg.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/menu/menu_info.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>通知管理</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="condition" name="名称" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="Notice.search()"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="NoticeTableToolbar" role="group"> |
| | | @if(shiro.hasPermission("/notice/add")){ |
| | | <#button name="添加" icon="fa-plus" clickFun="Notice.openAddNotice()"/> |
| | | @} |
| | | @if(shiro.hasPermission("/notice/update")){ |
| | | <#button name="修改" icon="fa-plus" clickFun="Notice.openNoticeDetail()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/notice/delete")){ |
| | | <#button name="删除" icon="fa-plus" clickFun="Notice.delete()" space="true"/> |
| | | @} |
| | | </div> |
| | | <#table id="NoticeTable"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/notice/notice.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="noticeInfoForm"> |
| | | |
| | | <input type="hidden" id="id" value=""> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-1 control-label">标题</label> |
| | | <div class="col-sm-11"> |
| | | <input class="form-control" id="title" name="title" type="text"> |
| | | |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-1 control-label">内容</label> |
| | | <div class="col-sm-11"> |
| | | <div id="editor" class="editorHeight"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="NoticeInfoDlg.addSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="NoticeInfoDlg.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script type="text/javascript" src="//unpkg.com/wangeditor/release/wangEditor.min.js"></script> |
| | | <script src="${ctxPath}/static/modular/system/notice/notice_info.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="noticeInfoForm"> |
| | | |
| | | <input type="hidden" id="id" value="${notice.id}"> |
| | | <input type="hidden" id="contentVal" value='${notice.content}'> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-1 control-label">标题</label> |
| | | <div class="col-sm-11"> |
| | | <input class="form-control" id="title" name="title" type="text" value="${notice.title}"> |
| | | |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-1 control-label">内容</label> |
| | | <div class="col-sm-11"> |
| | | <div id="editor" class="editorHeight"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="NoticeInfoDlg.editSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="NoticeInfoDlg.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script type="text/javascript" src="${ctxPath}/static/js/plugins/wangEditor/wangEditor.js"></script> |
| | | <script src="${ctxPath}/static/modular/system/notice/notice_info.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>角色管理</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="roleName" name="角色名称" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="Role.search()"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="roleTableToolbar" role="group"> |
| | | @if(shiro.hasPermission("/role/add")){ |
| | | <#button name="添加" icon="fa-plus" clickFun="Role.openAddRole()" /> |
| | | @} |
| | | @if(shiro.hasPermission("/role/edit")){ |
| | | <#button name="修改" icon="fa-edit" clickFun="Role.openChangeRole()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/role/remove")){ |
| | | <#button name="删除" icon="fa-remove" clickFun="Role.delRole()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/role/setAuthority")){ |
| | | <#button name="权限配置" icon="fa-user-secret" clickFun="Role.assign()" space="true"/> |
| | | @} |
| | | </div> |
| | | <#table id="roleTable"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/role/role.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="roleInfoForm"> |
| | | |
| | | <input type="hidden" id="id" value=""> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-6 b-r"> |
| | | <#input id="name" name="角色名称" underline="true"/> |
| | | <#input id="pName" name="上级名称" underline="true" hidden="pid" readonly="readonly" |
| | | clickFun="RolInfoDlg.showPNameSelectTree(); return false;" |
| | | style="background-color: #ffffff !important;"/> |
| | | <#input id="deptName" name="部门名称" hidden="deptid" readonly="readonly" |
| | | clickFun="RolInfoDlg.showDeptSelectTree(); return false;" |
| | | style="background-color: #ffffff !important;"/> |
| | | </div> |
| | | <div class="col-sm-6"> |
| | | <#input id="tips" name="别名" underline="true"/> |
| | | <#input id="num" name="排序"/> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 这是部门下拉框 --> |
| | | <div id="deptContent" class="menuContent" |
| | | style="display: none; position: absolute; z-index: 200;"> |
| | | <ul id="deptTree" class="ztree tree-box" style="width: 250px !important;"></ul> |
| | | </div> |
| | | |
| | | <!-- 这是父级菜单下拉框 --> |
| | | <div id="pNameContent" class="menuContent" |
| | | style="display: none; position: absolute; z-index: 200;"> |
| | | <ul id="pNameTree" class="ztree tree-box" style="width: 250px !important;"></ul> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="RolInfoDlg.addSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="RolInfoDlg.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/role/role_info.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | |
| | | |
| | | <script type="text/javascript"> |
| | | $(function () { |
| | | var index = parent.layer.getFrameIndex(window.name); //获取窗口索引 |
| | | |
| | | $("#btn_close").bind("click", function () { |
| | | parent.layer.close(index); |
| | | }); |
| | | |
| | | $("#btn_save").bind("click", function () { |
| | | var ids = Feng.zTreeCheckedNodes("zTree"); |
| | | var ajax = new $ax(Feng.ctxPath + "/role/setAuthority", function (data) { |
| | | Feng.success("分配角色成功!"); |
| | | window.parent.Role.table.refresh(); |
| | | parent.layer.close(index); |
| | | }, function (data) { |
| | | Feng.error("分配角色失败!" |
| | | + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("roleId", "${roleId}"); |
| | | ajax.set("ids", ids); |
| | | ajax.start(); |
| | | }); |
| | | |
| | | initZtree(); |
| | | }); |
| | | |
| | | function initZtree() { |
| | | var setting = { |
| | | check: { |
| | | enable: true, |
| | | chkboxType: { "Y": "ps", "N": "ps" } |
| | | }, |
| | | data: { |
| | | simpleData: { |
| | | enable: true |
| | | } |
| | | } |
| | | }; |
| | | |
| | | var ztree = new $ZTree("zTree", "/menu/menuTreeListByRoleId/" |
| | | + "${roleId}"); |
| | | ztree.setSettings(setting); |
| | | ztree.init(); |
| | | } |
| | | </script> |
| | | |
| | | |
| | | <!-- 配置grid --> |
| | | <div class="container" style="padding: 0px 10px !important;margin-top: -10px;text-align: center !important;"> |
| | | <div class="row"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>${roleName!}</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <ul id="zTree" class="ztree"></ul> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="row"> |
| | | <div class="col-md-12"> |
| | | <button class="btn btn-sm btn-info" type="button" id="btn_save"> |
| | | <i class="ace-icon fa fa-check bigger-110"></i>保存 |
| | | </button> |
| | | |
| | | <button class="btn btn-sm btn-danger" type="button" id="btn_close"> |
| | | <i class="ace-icon fa fa-close bigger-110"></i>关闭 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="roleInfoForm"> |
| | | |
| | | <input type="hidden" id="id" value="${role.id}"> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-6 b-r"> |
| | | <#input id="name" name="角色名称" underline="true" value="${role.name}"/> |
| | | <#input id="pName" name="上级名称" underline="true" hidden="pid" hiddenValue="${role.pid}" readonly="readonly" value="${pName}" |
| | | clickFun="RolInfoDlg.showPNameSelectTree(); return false;" |
| | | style="background-color: #ffffff !important;"/> |
| | | <#input id="deptName" name="部门名称" hidden="deptid" hiddenValue="${role.deptid}" readonly="readonly" value="${deptName}" |
| | | clickFun="RolInfoDlg.showDeptSelectTree(); return false;" |
| | | style="background-color: #ffffff !important;"/> |
| | | </div> |
| | | <div class="col-sm-6"> |
| | | <#input id="tips" name="别名" underline="true" value="${role.tips}"/> |
| | | <#input id="num" name="排序" value="${role.num}"/> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 这是部门下拉框 --> |
| | | <div id="deptContent" class="menuContent" |
| | | style="display: none; position: absolute; z-index: 200;"> |
| | | <ul id="deptTree" class="ztree tree-box" style="width: 250px !important;"></ul> |
| | | </div> |
| | | |
| | | <!-- 这是父级菜单下拉框 --> |
| | | <div id="pNameContent" class="menuContent" |
| | | style="display: none; position: absolute; z-index: 200;"> |
| | | <ul id="pNameTree" class="ztree tree-box" style="width: 250px !important;"></ul> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="RolInfoDlg.editSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="RolInfoDlg.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/role/role_info.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>用户管理</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="col-lg-2 col-sm-3"> |
| | | <div class="panel panel-default"> |
| | | <div class="panel-heading">组织机构</div> |
| | | <div class="panel-body dept-tree"> |
| | | <ul id="deptTree" class="ztree"></ul> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="col-lg-10 col-sm-9"> |
| | | <div class="row"> |
| | | <div class="col-lg-10 col-sm-9"> |
| | | <div class="row"> |
| | | <div class="col-lg-4 col-sm-12"> |
| | | <#NameCon id="name" name="用户名称" placeholder="帐号/姓名/手机号"/> |
| | | </div> |
| | | <div class="col-lg-4 col-sm-6"> |
| | | <#TimeCon id="beginTime" name="注册开始日期" isTime="false"/> |
| | | </div> |
| | | <div class="col-lg-4 col-sm-6"> |
| | | <#TimeCon id="endTime" name="注册结束日期" isTime="false"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="col-lg-2 col-sm-3"> |
| | | <div class="row"> |
| | | <div class="col-lg-12 col-sm-12"> |
| | | <#button name="搜索" icon="fa-search" clickFun="MgrUser.search()"/> |
| | | <#button name="重置" icon="fa-trash" clickFun="MgrUser.resetSearch()" space="true"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="managerTableToolbar" role="group"> |
| | | @if(shiro.hasPermission("/mgr/add")){ |
| | | <#button name="添加" icon="fa-plus" clickFun="MgrUser.openAddMgr()"/> |
| | | @} |
| | | @if(shiro.hasPermission("/mgr/edit")){ |
| | | <#button name="修改" icon="fa-edit" clickFun="MgrUser.openChangeUser()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/mgr/delete")){ |
| | | <#button name="删除" icon="fa-remove" clickFun="MgrUser.delMgrUser()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/mgr/reset")){ |
| | | <#button name="重置密码" icon="fa-refresh" clickFun="MgrUser.resetPwd()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/mgr/freeze")){ |
| | | <#button name="冻结" icon="fa-warning" clickFun="MgrUser.freezeAccount()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/mgr/unfreeze")){ |
| | | <#button name="解除冻结" icon="fa-check-circle" clickFun="MgrUser.unfreeze()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/mgr/setRole")){ |
| | | <#button name="角色分配" icon="fa-user-secret" clickFun="MgrUser.roleAssign()" space="true"/> |
| | | @} |
| | | </div> |
| | | <#table id="managerTable"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/user/user.js"></script> |
| | | <script> |
| | | laydate.render({ |
| | | elem: '#beginTime' |
| | | }); |
| | | laydate.render({ |
| | | elem: '#endTime' |
| | | }); |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="userInfoForm"> |
| | | |
| | | <input type="hidden" id="id" value=""> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-6 b-r"> |
| | | <#input id="account" name="账户" underline="true"/> |
| | | |
| | | <#select id="sex" name="性别" underline="true"> |
| | | <option value="1">男</option> |
| | | <option value="2">女</option> |
| | | </#select> |
| | | |
| | | <#input id="password" name="密码" underline="true" type="password"/> |
| | | |
| | | <#input id="roleid" name="角色" underline="true" disabled="disabled"/> |
| | | |
| | | <#input id="email" name="邮箱" type="email"/> |
| | | |
| | | </div> |
| | | <div class="col-sm-6"> |
| | | <div id="driverInfoContent"> |
| | | <#input id="name" name="姓名" underline="true"/> |
| | | |
| | | <#input id="birthday" name="出生日期" underline="true" type="text"/> |
| | | |
| | | <#input id="rePassword" name="确认密码" type="password" underline="true"/> |
| | | |
| | | <#input id="citySel" name="部门" underline="true" readonly="readonly" hidden="deptid" |
| | | clickFun="UserInfoDlg.showDeptSelectTree(); return false;" |
| | | style="background-color: #ffffff !important;"/> |
| | | |
| | | <#input id="phone" name="电话"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 这是部门选择的下拉框 --> |
| | | <div id="menuContent" class="menuContent" |
| | | style="display: none; position: absolute; z-index: 200;"> |
| | | <ul id="treeDemo" class="ztree tree-box" style="width: 249px !important;"></ul> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="UserInfoDlg.addSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="UserInfoDlg.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/user/user_info.js"></script> |
| | | <script> |
| | | laydate.render({ |
| | | elem: '#birthday' |
| | | }); |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="col-sm-4 col-sm-offset-4"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>修改密码</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content" style="border:none !important; "> |
| | | <div class="form-horizontal"> |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <#input id="oldPwd" name="原密码" underline="true" type="password"/> |
| | | <#input id="newPwd" name="新密码" underline="true" type="password"/> |
| | | <#input id="rePwd" name="新密码验证" type="password"/> |
| | | </div> |
| | | </div> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="UserInfoDlg.chPwd()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/user/user_info.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="userInfoForm"> |
| | | |
| | | <input type="hidden" id="id" value="${user.id}"> |
| | | <input type="hidden" id="sexValue" value="${user.sex}"> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-6 b-r"> |
| | | <#input id="account" name="账户" underline="true" value="${user.account}"/> |
| | | |
| | | <#select id="sex" name="性别" underline="true"> |
| | | <option value="1">男</option> |
| | | <option value="2">女</option> |
| | | </#select> |
| | | |
| | | <#input id="roleid" name="角色" underline="true" value="${roleName}" disabled="disabled"/> |
| | | |
| | | <#input id="email" name="邮箱" type="email" value="${user.email}"/> |
| | | </div> |
| | | <div class="col-sm-6"> |
| | | <div id="driverInfoContent"> |
| | | <#input id="name" name="姓名" underline="true" value="${user.name}"/> |
| | | |
| | | <#input id="birthday" name="出生日期" underline="true" type="text" |
| | | value="${user.birthday}"/> |
| | | |
| | | <#input id="citySel" name="部门" underline="true" readonly="readonly" hidden="deptid" hiddenValue="${user.deptid}" value="${deptName}" |
| | | clickFun="UserInfoDlg.showDeptSelectTree(); return false;" |
| | | style="background-color: #ffffff !important;"/> |
| | | |
| | | <#input id="phone" name="电话" value="${user.phone}"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 这是部门选择的下拉框 --> |
| | | <div id="menuContent" class="menuContent" |
| | | style="display: none; position: absolute; z-index: 200;"> |
| | | <ul id="treeDemo" class="ztree tree-box" style="width: 249px !important;"></ul> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="UserInfoDlg.editSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="UserInfoDlg.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/user/user_info.js"></script> |
| | | <script> |
| | | laydate.render({ |
| | | elem: '#birthday' |
| | | }); |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | |
| | | |
| | | <script type="text/javascript"> |
| | | $(function () { |
| | | |
| | | var index = parent.layer.getFrameIndex(window.name); //获取窗口索引 |
| | | |
| | | $("#btn_close").bind("click", function () { |
| | | parent.layer.close(index); |
| | | }); |
| | | |
| | | $("#btn_save").bind("click", function () { |
| | | var ids = Feng.zTreeCheckedNodes("zTree"); |
| | | var ajax = new $ax(Feng.ctxPath + "/mgr/setRole", function (data) { |
| | | Feng.success("分配角色成功!"); |
| | | window.parent.MgrUser.table.refresh(); |
| | | parent.layer.close(index); |
| | | }, function (data) { |
| | | Feng.error("分配角色失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("roleIds", ids); |
| | | ajax.set("userId", "${userId}"); |
| | | ajax.start(); |
| | | }); |
| | | |
| | | initZtree(); |
| | | }); |
| | | |
| | | function initZtree() { |
| | | var setting = { |
| | | check: { |
| | | enable: true, |
| | | chkboxType: { |
| | | "Y": "", |
| | | "N": "" |
| | | } |
| | | }, |
| | | data: { |
| | | simpleData: { |
| | | enable: true |
| | | } |
| | | } |
| | | }; |
| | | |
| | | var ztree = new $ZTree("zTree", "/role/roleTreeListByUserId/${userId}"); |
| | | ztree.setSettings(setting); |
| | | ztree.init(); |
| | | } |
| | | </script> |
| | | |
| | | |
| | | <!-- 配置grid --> |
| | | <div class="container" |
| | | style="padding: 0px 10px !important; margin-top: -10px; text-align: center !important;"> |
| | | <div class="row"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>${userAccount!}</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <ul id="zTree" class="ztree"></ul> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="row"> |
| | | <div class="col-md-12"> |
| | | <button class="btn btn-sm btn-info" type="button" id="btn_save"> |
| | | <i class="ace-icon fa fa-check bigger-110"></i> 保存 |
| | | </button> |
| | | |
| | | <button class="btn btn-sm btn-danger" type="button" id="btn_close"> |
| | | <i class="ace-icon fa fa-close bigger-110"></i> 关闭 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="col-sm-6 col-sm-offset-3"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>用户管理</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content" style="border:none !important; "> |
| | | <div class="form-horizontal" id="userInfoForm"> |
| | | |
| | | <input type="hidden" id="id" value="${user.id}"> |
| | | <input type="hidden" id="sexValue" value="${user.sex}"> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-6 b-r"> |
| | | <#avatar id="avatar" name="头像" underline="true" avatarImg="${user.avatar}"/> |
| | | |
| | | <#input id="account" name="账户" underline="true" value="${user.account}" disabled="disabled" /> |
| | | |
| | | <#select id="sex" name="性别" underline="true" value="${user.sex}"> |
| | | <option value="1">男</option> |
| | | <option value="2">女</option> |
| | | </#select> |
| | | |
| | | <#input id="roleid" name="角色" underline="true" value="${roleName}" disabled="disabled"/> |
| | | |
| | | <#input id="email" name="邮箱" type="email" value="${user.email}"/> |
| | | </div> |
| | | |
| | | <div class="col-sm-6"> |
| | | <div id="driverInfoContent"> |
| | | <#input id="name" name="姓名" underline="true" value="${user.name}"/> |
| | | |
| | | <#input id="birthday" name="出生日期" underline="true" type="text" |
| | | value="${user.birthday}"/> |
| | | |
| | | <#input id="citySel" name="部门" underline="true" readonly="readonly" value="${deptName}" |
| | | hidden="deptid" hiddenValue="${user.deptid}" |
| | | clickFun="UserInfoDlg.showInfoDeptSelectTree(); return false;" |
| | | style="background-color: #ffffff !important;" |
| | | selectFlag="true" selectId="menuContent" selectTreeId="treeDemo" selectStyle="width:250px !important;"/> |
| | | |
| | | <#input id="phone" name="电话" value="${user.phone}"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="progress progress-striped" id="progressTipArea" style="margin-top: 20px;"> |
| | | <div id="progressBar" style="width: 0%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="0" role="progressbar" class="progress-bar progress-bar-info"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="UserInfoDlg.editSubmit()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/user/user_info.js"></script> |
| | | <script> |
| | | laydate.render({ |
| | | elem: '#birthday' |
| | | }); |
| | | </script> |
| | | @} |
New file |
| | |
| | | .button-margin { |
| | | margin-left: 15px !important; |
| | | } |
| | | |
| | | .input-none-margin { |
| | | margin: 0px !important; |
| | | } |
| | | |
| | | .btn-margin-left { |
| | | margin-left: 15px !important; |
| | | } |
| | | |
| | | .table-head { |
| | | float: left; |
| | | width: 100%; |
| | | height: auto; |
| | | } |
| | | |
| | | .head-scu-label { |
| | | margin-top: 35px; |
| | | } |
| | | |
| | | .head-scu-btn { |
| | | margin-top: 68px; |
| | | } |
| | | |
| | | .line-margin { |
| | | margin: 8px 0 !important; |
| | | } |
| | | |
| | | .be-driver-checkbox { |
| | | margin-top: 7px; |
| | | } |
| | | |
| | | .btn-group-m-t { |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | .upload-btn { |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | .tree-box { |
| | | border-radius: 0px !important; |
| | | box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2) !important; |
| | | background: rgb(250, 250, 250) none repeat scroll 0% 0% !important; |
| | | border: 1px solid rgb(204, 204, 204) !important; |
| | | overflow-y: scroll !important; |
| | | overflow-x: auto !important; |
| | | margin-top: 0px !important; |
| | | width: 224px !important; |
| | | max-height: 160px !important; |
| | | -moz-user-select: none !important; |
| | | } |
| | | .dept-tree { |
| | | padding:10px |
| | | } |
| | | |
| | | .w-e-text-container{ |
| | | height: 150px !important; |
| | | } |
| | | |
| | | .editorHeight{ |
| | | height: 170px; |
| | | } |
New file |
| | |
| | | /******************************************************************************* |
| | | * bootstrap-rtl (version 3.3.1) |
| | | * Author: Morteza Ansarinia (http://github.com/morteza) |
| | | * Created on: January 21,2015 |
| | | * Project: bootstrap-rtl |
| | | * Copyright: Unlicensed Public Domain |
| | | *******************************************************************************/ |
| | | |
| | | html { |
| | | direction: rtl; |
| | | } |
| | | body { |
| | | direction: rtl; |
| | | } |
| | | .list-unstyled { |
| | | padding-right: 0; |
| | | padding-left: initial; |
| | | } |
| | | .list-inline { |
| | | padding-right: 0; |
| | | padding-left: initial; |
| | | margin-right: -5px; |
| | | margin-left: 0; |
| | | } |
| | | dd { |
| | | margin-right: 0; |
| | | margin-left: initial; |
| | | } |
| | | @media (min-width: 768px) { |
| | | .dl-horizontal dt { |
| | | float: right; |
| | | clear: right; |
| | | text-align: left; |
| | | } |
| | | .dl-horizontal dd { |
| | | margin-right: 180px; |
| | | margin-left: 0; |
| | | } |
| | | } |
| | | blockquote { |
| | | border-right: 5px solid #eeeeee; |
| | | border-left: 0; |
| | | } |
| | | .blockquote-reverse, |
| | | blockquote.pull-left { |
| | | padding-left: 15px; |
| | | padding-right: 0; |
| | | border-left: 5px solid #eeeeee; |
| | | border-right: 0; |
| | | text-align: left; |
| | | } |
| | | .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 { |
| | | position: relative; |
| | | min-height: 1px; |
| | | padding-left: 15px; |
| | | padding-right: 15px; |
| | | } |
| | | .col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 { |
| | | float: right; |
| | | } |
| | | .col-xs-12 { |
| | | width: 100%; |
| | | } |
| | | .col-xs-11 { |
| | | width: 91.66666667%; |
| | | } |
| | | .col-xs-10 { |
| | | width: 83.33333333%; |
| | | } |
| | | .col-xs-9 { |
| | | width: 75%; |
| | | } |
| | | .col-xs-8 { |
| | | width: 66.66666667%; |
| | | } |
| | | .col-xs-7 { |
| | | width: 58.33333333%; |
| | | } |
| | | .col-xs-6 { |
| | | width: 50%; |
| | | } |
| | | .col-xs-5 { |
| | | width: 41.66666667%; |
| | | } |
| | | .col-xs-4 { |
| | | width: 33.33333333%; |
| | | } |
| | | .col-xs-3 { |
| | | width: 25%; |
| | | } |
| | | .col-xs-2 { |
| | | width: 16.66666667%; |
| | | } |
| | | .col-xs-1 { |
| | | width: 8.33333333%; |
| | | } |
| | | .col-xs-pull-12 { |
| | | left: 100%; |
| | | right: auto; |
| | | } |
| | | .col-xs-pull-11 { |
| | | left: 91.66666667%; |
| | | right: auto; |
| | | } |
| | | .col-xs-pull-10 { |
| | | left: 83.33333333%; |
| | | right: auto; |
| | | } |
| | | .col-xs-pull-9 { |
| | | left: 75%; |
| | | right: auto; |
| | | } |
| | | .col-xs-pull-8 { |
| | | left: 66.66666667%; |
| | | right: auto; |
| | | } |
| | | .col-xs-pull-7 { |
| | | left: 58.33333333%; |
| | | right: auto; |
| | | } |
| | | .col-xs-pull-6 { |
| | | left: 50%; |
| | | right: auto; |
| | | } |
| | | .col-xs-pull-5 { |
| | | left: 41.66666667%; |
| | | right: auto; |
| | | } |
| | | .col-xs-pull-4 { |
| | | left: 33.33333333%; |
| | | right: auto; |
| | | } |
| | | .col-xs-pull-3 { |
| | | left: 25%; |
| | | right: auto; |
| | | } |
| | | .col-xs-pull-2 { |
| | | left: 16.66666667%; |
| | | right: auto; |
| | | } |
| | | .col-xs-pull-1 { |
| | | left: 8.33333333%; |
| | | right: auto; |
| | | } |
| | | .col-xs-pull-0 { |
| | | left: auto; |
| | | right: auto; |
| | | } |
| | | .col-xs-push-12 { |
| | | right: 100%; |
| | | left: 0; |
| | | } |
| | | .col-xs-push-11 { |
| | | right: 91.66666667%; |
| | | left: 0; |
| | | } |
| | | .col-xs-push-10 { |
| | | right: 83.33333333%; |
| | | left: 0; |
| | | } |
| | | .col-xs-push-9 { |
| | | right: 75%; |
| | | left: 0; |
| | | } |
| | | .col-xs-push-8 { |
| | | right: 66.66666667%; |
| | | left: 0; |
| | | } |
| | | .col-xs-push-7 { |
| | | right: 58.33333333%; |
| | | left: 0; |
| | | } |
| | | .col-xs-push-6 { |
| | | right: 50%; |
| | | left: 0; |
| | | } |
| | | .col-xs-push-5 { |
| | | right: 41.66666667%; |
| | | left: 0; |
| | | } |
| | | .col-xs-push-4 { |
| | | right: 33.33333333%; |
| | | left: 0; |
| | | } |
| | | .col-xs-push-3 { |
| | | right: 25%; |
| | | left: 0; |
| | | } |
| | | .col-xs-push-2 { |
| | | right: 16.66666667%; |
| | | left: 0; |
| | | } |
| | | .col-xs-push-1 { |
| | | right: 8.33333333%; |
| | | left: 0; |
| | | } |
| | | .col-xs-push-0 { |
| | | right: auto; |
| | | left: 0; |
| | | } |
| | | .col-xs-offset-12 { |
| | | margin-right: 100%; |
| | | margin-left: 0; |
| | | } |
| | | .col-xs-offset-11 { |
| | | margin-right: 91.66666667%; |
| | | margin-left: 0; |
| | | } |
| | | .col-xs-offset-10 { |
| | | margin-right: 83.33333333%; |
| | | margin-left: 0; |
| | | } |
| | | .col-xs-offset-9 { |
| | | margin-right: 75%; |
| | | margin-left: 0; |
| | | } |
| | | .col-xs-offset-8 { |
| | | margin-right: 66.66666667%; |
| | | margin-left: 0; |
| | | } |
| | | .col-xs-offset-7 { |
| | | margin-right: 58.33333333%; |
| | | margin-left: 0; |
| | | } |
| | | .col-xs-offset-6 { |
| | | margin-right: 50%; |
| | | margin-left: 0; |
| | | } |
| | | .col-xs-offset-5 { |
| | | margin-right: 41.66666667%; |
| | | margin-left: 0; |
| | | } |
| | | .col-xs-offset-4 { |
| | | margin-right: 33.33333333%; |
| | | margin-left: 0; |
| | | } |
| | | .col-xs-offset-3 { |
| | | margin-right: 25%; |
| | | margin-left: 0; |
| | | } |
| | | .col-xs-offset-2 { |
| | | margin-right: 16.66666667%; |
| | | margin-left: 0; |
| | | } |
| | | .col-xs-offset-1 { |
| | | margin-right: 8.33333333%; |
| | | margin-left: 0; |
| | | } |
| | | .col-xs-offset-0 { |
| | | margin-right: 0%; |
| | | margin-left: 0; |
| | | } |
| | | @media (min-width: 768px) { |
| | | .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 { |
| | | float: right; |
| | | } |
| | | .col-sm-12 { |
| | | width: 100%; |
| | | } |
| | | .col-sm-11 { |
| | | width: 91.66666667%; |
| | | } |
| | | .col-sm-10 { |
| | | width: 83.33333333%; |
| | | } |
| | | .col-sm-9 { |
| | | width: 75%; |
| | | } |
| | | .col-sm-8 { |
| | | width: 66.66666667%; |
| | | } |
| | | .col-sm-7 { |
| | | width: 58.33333333%; |
| | | } |
| | | .col-sm-6 { |
| | | width: 50%; |
| | | } |
| | | .col-sm-5 { |
| | | width: 41.66666667%; |
| | | } |
| | | .col-sm-4 { |
| | | width: 33.33333333%; |
| | | } |
| | | .col-sm-3 { |
| | | width: 25%; |
| | | } |
| | | .col-sm-2 { |
| | | width: 16.66666667%; |
| | | } |
| | | .col-sm-1 { |
| | | width: 8.33333333%; |
| | | } |
| | | .col-sm-pull-12 { |
| | | left: 100%; |
| | | right: auto; |
| | | } |
| | | .col-sm-pull-11 { |
| | | left: 91.66666667%; |
| | | right: auto; |
| | | } |
| | | .col-sm-pull-10 { |
| | | left: 83.33333333%; |
| | | right: auto; |
| | | } |
| | | .col-sm-pull-9 { |
| | | left: 75%; |
| | | right: auto; |
| | | } |
| | | .col-sm-pull-8 { |
| | | left: 66.66666667%; |
| | | right: auto; |
| | | } |
| | | .col-sm-pull-7 { |
| | | left: 58.33333333%; |
| | | right: auto; |
| | | } |
| | | .col-sm-pull-6 { |
| | | left: 50%; |
| | | right: auto; |
| | | } |
| | | .col-sm-pull-5 { |
| | | left: 41.66666667%; |
| | | right: auto; |
| | | } |
| | | .col-sm-pull-4 { |
| | | left: 33.33333333%; |
| | | right: auto; |
| | | } |
| | | .col-sm-pull-3 { |
| | | left: 25%; |
| | | right: auto; |
| | | } |
| | | .col-sm-pull-2 { |
| | | left: 16.66666667%; |
| | | right: auto; |
| | | } |
| | | .col-sm-pull-1 { |
| | | left: 8.33333333%; |
| | | right: auto; |
| | | } |
| | | .col-sm-pull-0 { |
| | | left: auto; |
| | | right: auto; |
| | | } |
| | | .col-sm-push-12 { |
| | | right: 100%; |
| | | left: 0; |
| | | } |
| | | .col-sm-push-11 { |
| | | right: 91.66666667%; |
| | | left: 0; |
| | | } |
| | | .col-sm-push-10 { |
| | | right: 83.33333333%; |
| | | left: 0; |
| | | } |
| | | .col-sm-push-9 { |
| | | right: 75%; |
| | | left: 0; |
| | | } |
| | | .col-sm-push-8 { |
| | | right: 66.66666667%; |
| | | left: 0; |
| | | } |
| | | .col-sm-push-7 { |
| | | right: 58.33333333%; |
| | | left: 0; |
| | | } |
| | | .col-sm-push-6 { |
| | | right: 50%; |
| | | left: 0; |
| | | } |
| | | .col-sm-push-5 { |
| | | right: 41.66666667%; |
| | | left: 0; |
| | | } |
| | | .col-sm-push-4 { |
| | | right: 33.33333333%; |
| | | left: 0; |
| | | } |
| | | .col-sm-push-3 { |
| | | right: 25%; |
| | | left: 0; |
| | | } |
| | | .col-sm-push-2 { |
| | | right: 16.66666667%; |
| | | left: 0; |
| | | } |
| | | .col-sm-push-1 { |
| | | right: 8.33333333%; |
| | | left: 0; |
| | | } |
| | | .col-sm-push-0 { |
| | | right: auto; |
| | | left: 0; |
| | | } |
| | | .col-sm-offset-12 { |
| | | margin-right: 100%; |
| | | margin-left: 0; |
| | | } |
| | | .col-sm-offset-11 { |
| | | margin-right: 91.66666667%; |
| | | margin-left: 0; |
| | | } |
| | | .col-sm-offset-10 { |
| | | margin-right: 83.33333333%; |
| | | margin-left: 0; |
| | | } |
| | | .col-sm-offset-9 { |
| | | margin-right: 75%; |
| | | margin-left: 0; |
| | | } |
| | | .col-sm-offset-8 { |
| | | margin-right: 66.66666667%; |
| | | margin-left: 0; |
| | | } |
| | | .col-sm-offset-7 { |
| | | margin-right: 58.33333333%; |
| | | margin-left: 0; |
| | | } |
| | | .col-sm-offset-6 { |
| | | margin-right: 50%; |
| | | margin-left: 0; |
| | | } |
| | | .col-sm-offset-5 { |
| | | margin-right: 41.66666667%; |
| | | margin-left: 0; |
| | | } |
| | | .col-sm-offset-4 { |
| | | margin-right: 33.33333333%; |
| | | margin-left: 0; |
| | | } |
| | | .col-sm-offset-3 { |
| | | margin-right: 25%; |
| | | margin-left: 0; |
| | | } |
| | | .col-sm-offset-2 { |
| | | margin-right: 16.66666667%; |
| | | margin-left: 0; |
| | | } |
| | | .col-sm-offset-1 { |
| | | margin-right: 8.33333333%; |
| | | margin-left: 0; |
| | | } |
| | | .col-sm-offset-0 { |
| | | margin-right: 0%; |
| | | margin-left: 0; |
| | | } |
| | | } |
| | | @media (min-width: 992px) { |
| | | .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 { |
| | | float: right; |
| | | } |
| | | .col-md-12 { |
| | | width: 100%; |
| | | } |
| | | .col-md-11 { |
| | | width: 91.66666667%; |
| | | } |
| | | .col-md-10 { |
| | | width: 83.33333333%; |
| | | } |
| | | .col-md-9 { |
| | | width: 75%; |
| | | } |
| | | .col-md-8 { |
| | | width: 66.66666667%; |
| | | } |
| | | .col-md-7 { |
| | | width: 58.33333333%; |
| | | } |
| | | .col-md-6 { |
| | | width: 50%; |
| | | } |
| | | .col-md-5 { |
| | | width: 41.66666667%; |
| | | } |
| | | .col-md-4 { |
| | | width: 33.33333333%; |
| | | } |
| | | .col-md-3 { |
| | | width: 25%; |
| | | } |
| | | .col-md-2 { |
| | | width: 16.66666667%; |
| | | } |
| | | .col-md-1 { |
| | | width: 8.33333333%; |
| | | } |
| | | .col-md-pull-12 { |
| | | left: 100%; |
| | | right: auto; |
| | | } |
| | | .col-md-pull-11 { |
| | | left: 91.66666667%; |
| | | right: auto; |
| | | } |
| | | .col-md-pull-10 { |
| | | left: 83.33333333%; |
| | | right: auto; |
| | | } |
| | | .col-md-pull-9 { |
| | | left: 75%; |
| | | right: auto; |
| | | } |
| | | .col-md-pull-8 { |
| | | left: 66.66666667%; |
| | | right: auto; |
| | | } |
| | | .col-md-pull-7 { |
| | | left: 58.33333333%; |
| | | right: auto; |
| | | } |
| | | .col-md-pull-6 { |
| | | left: 50%; |
| | | right: auto; |
| | | } |
| | | .col-md-pull-5 { |
| | | left: 41.66666667%; |
| | | right: auto; |
| | | } |
| | | .col-md-pull-4 { |
| | | left: 33.33333333%; |
| | | right: auto; |
| | | } |
| | | .col-md-pull-3 { |
| | | left: 25%; |
| | | right: auto; |
| | | } |
| | | .col-md-pull-2 { |
| | | left: 16.66666667%; |
| | | right: auto; |
| | | } |
| | | .col-md-pull-1 { |
| | | left: 8.33333333%; |
| | | right: auto; |
| | | } |
| | | .col-md-pull-0 { |
| | | left: auto; |
| | | right: auto; |
| | | } |
| | | .col-md-push-12 { |
| | | right: 100%; |
| | | left: 0; |
| | | } |
| | | .col-md-push-11 { |
| | | right: 91.66666667%; |
| | | left: 0; |
| | | } |
| | | .col-md-push-10 { |
| | | right: 83.33333333%; |
| | | left: 0; |
| | | } |
| | | .col-md-push-9 { |
| | | right: 75%; |
| | | left: 0; |
| | | } |
| | | .col-md-push-8 { |
| | | right: 66.66666667%; |
| | | left: 0; |
| | | } |
| | | .col-md-push-7 { |
| | | right: 58.33333333%; |
| | | left: 0; |
| | | } |
| | | .col-md-push-6 { |
| | | right: 50%; |
| | | left: 0; |
| | | } |
| | | .col-md-push-5 { |
| | | right: 41.66666667%; |
| | | left: 0; |
| | | } |
| | | .col-md-push-4 { |
| | | right: 33.33333333%; |
| | | left: 0; |
| | | } |
| | | .col-md-push-3 { |
| | | right: 25%; |
| | | left: 0; |
| | | } |
| | | .col-md-push-2 { |
| | | right: 16.66666667%; |
| | | left: 0; |
| | | } |
| | | .col-md-push-1 { |
| | | right: 8.33333333%; |
| | | left: 0; |
| | | } |
| | | .col-md-push-0 { |
| | | right: auto; |
| | | left: 0; |
| | | } |
| | | .col-md-offset-12 { |
| | | margin-right: 100%; |
| | | margin-left: 0; |
| | | } |
| | | .col-md-offset-11 { |
| | | margin-right: 91.66666667%; |
| | | margin-left: 0; |
| | | } |
| | | .col-md-offset-10 { |
| | | margin-right: 83.33333333%; |
| | | margin-left: 0; |
| | | } |
| | | .col-md-offset-9 { |
| | | margin-right: 75%; |
| | | margin-left: 0; |
| | | } |
| | | .col-md-offset-8 { |
| | | margin-right: 66.66666667%; |
| | | margin-left: 0; |
| | | } |
| | | .col-md-offset-7 { |
| | | margin-right: 58.33333333%; |
| | | margin-left: 0; |
| | | } |
| | | .col-md-offset-6 { |
| | | margin-right: 50%; |
| | | margin-left: 0; |
| | | } |
| | | .col-md-offset-5 { |
| | | margin-right: 41.66666667%; |
| | | margin-left: 0; |
| | | } |
| | | .col-md-offset-4 { |
| | | margin-right: 33.33333333%; |
| | | margin-left: 0; |
| | | } |
| | | .col-md-offset-3 { |
| | | margin-right: 25%; |
| | | margin-left: 0; |
| | | } |
| | | .col-md-offset-2 { |
| | | margin-right: 16.66666667%; |
| | | margin-left: 0; |
| | | } |
| | | .col-md-offset-1 { |
| | | margin-right: 8.33333333%; |
| | | margin-left: 0; |
| | | } |
| | | .col-md-offset-0 { |
| | | margin-right: 0%; |
| | | margin-left: 0; |
| | | } |
| | | } |
| | | @media (min-width: 1200px) { |
| | | .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 { |
| | | float: right; |
| | | } |
| | | .col-lg-12 { |
| | | width: 100%; |
| | | } |
| | | .col-lg-11 { |
| | | width: 91.66666667%; |
| | | } |
| | | .col-lg-10 { |
| | | width: 83.33333333%; |
| | | } |
| | | .col-lg-9 { |
| | | width: 75%; |
| | | } |
| | | .col-lg-8 { |
| | | width: 66.66666667%; |
| | | } |
| | | .col-lg-7 { |
| | | width: 58.33333333%; |
| | | } |
| | | .col-lg-6 { |
| | | width: 50%; |
| | | } |
| | | .col-lg-5 { |
| | | width: 41.66666667%; |
| | | } |
| | | .col-lg-4 { |
| | | width: 33.33333333%; |
| | | } |
| | | .col-lg-3 { |
| | | width: 25%; |
| | | } |
| | | .col-lg-2 { |
| | | width: 16.66666667%; |
| | | } |
| | | .col-lg-1 { |
| | | width: 8.33333333%; |
| | | } |
| | | .col-lg-pull-12 { |
| | | left: 100%; |
| | | right: auto; |
| | | } |
| | | .col-lg-pull-11 { |
| | | left: 91.66666667%; |
| | | right: auto; |
| | | } |
| | | .col-lg-pull-10 { |
| | | left: 83.33333333%; |
| | | right: auto; |
| | | } |
| | | .col-lg-pull-9 { |
| | | left: 75%; |
| | | right: auto; |
| | | } |
| | | .col-lg-pull-8 { |
| | | left: 66.66666667%; |
| | | right: auto; |
| | | } |
| | | .col-lg-pull-7 { |
| | | left: 58.33333333%; |
| | | right: auto; |
| | | } |
| | | .col-lg-pull-6 { |
| | | left: 50%; |
| | | right: auto; |
| | | } |
| | | .col-lg-pull-5 { |
| | | left: 41.66666667%; |
| | | right: auto; |
| | | } |
| | | .col-lg-pull-4 { |
| | | left: 33.33333333%; |
| | | right: auto; |
| | | } |
| | | .col-lg-pull-3 { |
| | | left: 25%; |
| | | right: auto; |
| | | } |
| | | .col-lg-pull-2 { |
| | | left: 16.66666667%; |
| | | right: auto; |
| | | } |
| | | .col-lg-pull-1 { |
| | | left: 8.33333333%; |
| | | right: auto; |
| | | } |
| | | .col-lg-pull-0 { |
| | | left: auto; |
| | | right: auto; |
| | | } |
| | | .col-lg-push-12 { |
| | | right: 100%; |
| | | left: 0; |
| | | } |
| | | .col-lg-push-11 { |
| | | right: 91.66666667%; |
| | | left: 0; |
| | | } |
| | | .col-lg-push-10 { |
| | | right: 83.33333333%; |
| | | left: 0; |
| | | } |
| | | .col-lg-push-9 { |
| | | right: 75%; |
| | | left: 0; |
| | | } |
| | | .col-lg-push-8 { |
| | | right: 66.66666667%; |
| | | left: 0; |
| | | } |
| | | .col-lg-push-7 { |
| | | right: 58.33333333%; |
| | | left: 0; |
| | | } |
| | | .col-lg-push-6 { |
| | | right: 50%; |
| | | left: 0; |
| | | } |
| | | .col-lg-push-5 { |
| | | right: 41.66666667%; |
| | | left: 0; |
| | | } |
| | | .col-lg-push-4 { |
| | | right: 33.33333333%; |
| | | left: 0; |
| | | } |
| | | .col-lg-push-3 { |
| | | right: 25%; |
| | | left: 0; |
| | | } |
| | | .col-lg-push-2 { |
| | | right: 16.66666667%; |
| | | left: 0; |
| | | } |
| | | .col-lg-push-1 { |
| | | right: 8.33333333%; |
| | | left: 0; |
| | | } |
| | | .col-lg-push-0 { |
| | | right: auto; |
| | | left: 0; |
| | | } |
| | | .col-lg-offset-12 { |
| | | margin-right: 100%; |
| | | margin-left: 0; |
| | | } |
| | | .col-lg-offset-11 { |
| | | margin-right: 91.66666667%; |
| | | margin-left: 0; |
| | | } |
| | | .col-lg-offset-10 { |
| | | margin-right: 83.33333333%; |
| | | margin-left: 0; |
| | | } |
| | | .col-lg-offset-9 { |
| | | margin-right: 75%; |
| | | margin-left: 0; |
| | | } |
| | | .col-lg-offset-8 { |
| | | margin-right: 66.66666667%; |
| | | margin-left: 0; |
| | | } |
| | | .col-lg-offset-7 { |
| | | margin-right: 58.33333333%; |
| | | margin-left: 0; |
| | | } |
| | | .col-lg-offset-6 { |
| | | margin-right: 50%; |
| | | margin-left: 0; |
| | | } |
| | | .col-lg-offset-5 { |
| | | margin-right: 41.66666667%; |
| | | margin-left: 0; |
| | | } |
| | | .col-lg-offset-4 { |
| | | margin-right: 33.33333333%; |
| | | margin-left: 0; |
| | | } |
| | | .col-lg-offset-3 { |
| | | margin-right: 25%; |
| | | margin-left: 0; |
| | | } |
| | | .col-lg-offset-2 { |
| | | margin-right: 16.66666667%; |
| | | margin-left: 0; |
| | | } |
| | | .col-lg-offset-1 { |
| | | margin-right: 8.33333333%; |
| | | margin-left: 0; |
| | | } |
| | | .col-lg-offset-0 { |
| | | margin-right: 0%; |
| | | margin-left: 0; |
| | | } |
| | | } |
| | | caption { |
| | | text-align: right; |
| | | } |
| | | th { |
| | | text-align: right; |
| | | } |
| | | @media screen and (max-width: 767px) { |
| | | .table-responsive > .table-bordered { |
| | | border: 0; |
| | | } |
| | | .table-responsive > .table-bordered > thead > tr > th:first-child, |
| | | .table-responsive > .table-bordered > tbody > tr > th:first-child, |
| | | .table-responsive > .table-bordered > tfoot > tr > th:first-child, |
| | | .table-responsive > .table-bordered > thead > tr > td:first-child, |
| | | .table-responsive > .table-bordered > tbody > tr > td:first-child, |
| | | .table-responsive > .table-bordered > tfoot > tr > td:first-child { |
| | | border-right: 0; |
| | | border-left: initial; |
| | | } |
| | | .table-responsive > .table-bordered > thead > tr > th:last-child, |
| | | .table-responsive > .table-bordered > tbody > tr > th:last-child, |
| | | .table-responsive > .table-bordered > tfoot > tr > th:last-child, |
| | | .table-responsive > .table-bordered > thead > tr > td:last-child, |
| | | .table-responsive > .table-bordered > tbody > tr > td:last-child, |
| | | .table-responsive > .table-bordered > tfoot > tr > td:last-child { |
| | | border-left: 0; |
| | | border-right: initial; |
| | | } |
| | | } |
| | | .radio label, |
| | | .checkbox label { |
| | | padding-right: 20px; |
| | | padding-left: initial; |
| | | } |
| | | .radio input[type="radio"], |
| | | .radio-inline input[type="radio"], |
| | | .checkbox input[type="checkbox"], |
| | | .checkbox-inline input[type="checkbox"] { |
| | | margin-right: -20px; |
| | | margin-left: auto; |
| | | } |
| | | .radio-inline, |
| | | .checkbox-inline { |
| | | padding-right: 20px; |
| | | padding-left: 0; |
| | | } |
| | | .radio-inline + .radio-inline, |
| | | .checkbox-inline + .checkbox-inline { |
| | | margin-right: 10px; |
| | | margin-left: 0; |
| | | } |
| | | .has-feedback .form-control { |
| | | padding-left: 42.5px; |
| | | padding-right: 12px; |
| | | } |
| | | .form-control-feedback { |
| | | left: 0; |
| | | right: auto; |
| | | } |
| | | @media (min-width: 768px) { |
| | | .form-inline label { |
| | | padding-right: 0; |
| | | padding-left: initial; |
| | | } |
| | | .form-inline .radio input[type="radio"], |
| | | .form-inline .checkbox input[type="checkbox"] { |
| | | margin-right: 0; |
| | | margin-left: auto; |
| | | } |
| | | } |
| | | @media (min-width: 768px) { |
| | | .form-horizontal .control-label { |
| | | text-align: left; |
| | | } |
| | | } |
| | | .form-horizontal .has-feedback .form-control-feedback { |
| | | left: 15px; |
| | | right: auto; |
| | | } |
| | | .caret { |
| | | margin-right: 2px; |
| | | margin-left: 0; |
| | | } |
| | | .dropdown-menu { |
| | | right: 0; |
| | | left: auto; |
| | | float: left; |
| | | text-align: right; |
| | | } |
| | | .dropdown-menu.pull-right { |
| | | left: 0; |
| | | right: auto; |
| | | float: right; |
| | | } |
| | | .dropdown-menu-right { |
| | | left: auto; |
| | | right: 0; |
| | | } |
| | | .dropdown-menu-left { |
| | | left: 0; |
| | | right: auto; |
| | | } |
| | | @media (min-width: 768px) { |
| | | .navbar-right .dropdown-menu { |
| | | left: auto; |
| | | right: 0; |
| | | } |
| | | .navbar-right .dropdown-menu-left { |
| | | left: 0; |
| | | right: auto; |
| | | } |
| | | } |
| | | .btn-group > .btn, |
| | | .btn-group-vertical > .btn { |
| | | float: right; |
| | | } |
| | | .btn-group .btn + .btn, |
| | | .btn-group .btn + .btn-group, |
| | | .btn-group .btn-group + .btn, |
| | | .btn-group .btn-group + .btn-group { |
| | | margin-right: -1px; |
| | | margin-left: 0px; |
| | | } |
| | | .btn-toolbar { |
| | | margin-right: -5px; |
| | | margin-left: 0px; |
| | | } |
| | | .btn-toolbar .btn-group, |
| | | .btn-toolbar .input-group { |
| | | float: right; |
| | | } |
| | | .btn-toolbar > .btn, |
| | | .btn-toolbar > .btn-group, |
| | | .btn-toolbar > .input-group { |
| | | margin-right: 5px; |
| | | margin-left: 0px; |
| | | } |
| | | .btn-group > .btn:first-child { |
| | | margin-right: 0; |
| | | } |
| | | .btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) { |
| | | border-top-right-radius: 4px; |
| | | border-bottom-right-radius: 4px; |
| | | border-bottom-left-radius: 0; |
| | | border-top-left-radius: 0; |
| | | } |
| | | .btn-group > .btn:last-child:not(:first-child), |
| | | .btn-group > .dropdown-toggle:not(:first-child) { |
| | | border-top-left-radius: 4px; |
| | | border-bottom-left-radius: 4px; |
| | | border-bottom-right-radius: 0; |
| | | border-top-right-radius: 0; |
| | | } |
| | | .btn-group > .btn-group { |
| | | float: right; |
| | | } |
| | | .btn-group.btn-group-justified > .btn, |
| | | .btn-group.btn-group-justified > .btn-group { |
| | | float: none; |
| | | } |
| | | .btn-group > .btn-group:not(:first-child):not(:last-child) > .btn { |
| | | border-radius: 0; |
| | | } |
| | | .btn-group > .btn-group:first-child > .btn:last-child, |
| | | .btn-group > .btn-group:first-child > .dropdown-toggle { |
| | | border-top-right-radius: 4px; |
| | | border-bottom-right-radius: 4px; |
| | | border-bottom-left-radius: 0; |
| | | border-top-left-radius: 0; |
| | | } |
| | | .btn-group > .btn-group:last-child > .btn:first-child { |
| | | border-top-left-radius: 4px; |
| | | border-bottom-left-radius: 4px; |
| | | border-bottom-right-radius: 0; |
| | | border-top-right-radius: 0; |
| | | } |
| | | .btn .caret { |
| | | margin-right: 0; |
| | | } |
| | | .btn-group-vertical > .btn + .btn, |
| | | .btn-group-vertical > .btn + .btn-group, |
| | | .btn-group-vertical > .btn-group + .btn, |
| | | .btn-group-vertical > .btn-group + .btn-group { |
| | | margin-top: -1px; |
| | | margin-right: 0; |
| | | } |
| | | .input-group .form-control { |
| | | float: right; |
| | | } |
| | | .input-group .form-control:first-child, |
| | | .input-group-addon:first-child, |
| | | .input-group-btn:first-child > .btn, |
| | | .input-group-btn:first-child > .btn-group > .btn, |
| | | .input-group-btn:first-child > .dropdown-toggle, |
| | | .input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle), |
| | | .input-group-btn:last-child > .btn-group:not(:last-child) > .btn { |
| | | border-bottom-right-radius: 4px; |
| | | border-top-right-radius: 4px; |
| | | border-bottom-left-radius: 0; |
| | | border-top-left-radius: 0; |
| | | } |
| | | .input-group-addon:first-child { |
| | | border-right-width: 1px; |
| | | border-right-style: solid; |
| | | border-left: 0px; |
| | | } |
| | | .input-group .form-control:last-child, |
| | | .input-group-addon:last-child, |
| | | .input-group-btn:last-child > .btn, |
| | | .input-group-btn:last-child > .btn-group > .btn, |
| | | .input-group-btn:last-child > .dropdown-toggle, |
| | | .input-group-btn:first-child > .btn:not(:first-child), |
| | | .input-group-btn:first-child > .btn-group:not(:first-child) > .btn { |
| | | border-bottom-left-radius: 4px; |
| | | border-top-left-radius: 4px; |
| | | border-bottom-right-radius: 0; |
| | | border-top-right-radius: 0; |
| | | } |
| | | .input-group-addon:last-child { |
| | | border-left-width: 1px; |
| | | border-left-style: solid; |
| | | border-right: 0px; |
| | | } |
| | | .input-group-btn > .btn + .btn { |
| | | margin-right: -1px; |
| | | margin-left: auto; |
| | | } |
| | | .input-group-btn:first-child > .btn, |
| | | .input-group-btn:first-child > .btn-group { |
| | | margin-left: -1px; |
| | | margin-right: auto; |
| | | } |
| | | .input-group-btn:last-child > .btn, |
| | | .input-group-btn:last-child > .btn-group { |
| | | margin-right: -1px; |
| | | margin-left: auto; |
| | | } |
| | | .nav { |
| | | padding-right: 0; |
| | | padding-left: initial; |
| | | } |
| | | .nav-tabs > li { |
| | | float: right; |
| | | } |
| | | .nav-tabs > li > a { |
| | | margin-left: auto; |
| | | margin-right: -2px; |
| | | border-radius: 4px 4px 0 0; |
| | | } |
| | | .nav-pills > li { |
| | | float: right; |
| | | } |
| | | .nav-pills > li > a { |
| | | border-radius: 4px; |
| | | } |
| | | .nav-pills > li + li { |
| | | margin-right: 2px; |
| | | margin-left: auto; |
| | | } |
| | | .nav-stacked > li { |
| | | float: none; |
| | | } |
| | | .nav-stacked > li + li { |
| | | margin-right: 0; |
| | | margin-left: auto; |
| | | } |
| | | .nav-justified > .dropdown .dropdown-menu { |
| | | right: auto; |
| | | } |
| | | .nav-tabs-justified > li > a { |
| | | margin-left: 0; |
| | | margin-right: auto; |
| | | } |
| | | @media (min-width: 768px) { |
| | | .nav-tabs-justified > li > a { |
| | | border-radius: 4px 4px 0 0; |
| | | } |
| | | } |
| | | @media (min-width: 768px) { |
| | | .navbar-header { |
| | | float: right; |
| | | } |
| | | } |
| | | .navbar-collapse { |
| | | padding-right: 15px; |
| | | padding-left: 15px; |
| | | } |
| | | .navbar-brand { |
| | | float: right; |
| | | } |
| | | @media (min-width: 768px) { |
| | | .navbar > .container .navbar-brand, |
| | | .navbar > .container-fluid .navbar-brand { |
| | | margin-right: -15px; |
| | | margin-left: auto; |
| | | } |
| | | } |
| | | .navbar-toggle { |
| | | float: left; |
| | | margin-left: 15px; |
| | | margin-right: auto; |
| | | } |
| | | @media (max-width: 767px) { |
| | | .navbar-nav .open .dropdown-menu > li > a, |
| | | .navbar-nav .open .dropdown-menu .dropdown-header { |
| | | padding: 5px 25px 5px 15px; |
| | | } |
| | | } |
| | | @media (min-width: 768px) { |
| | | .navbar-nav { |
| | | float: right; |
| | | } |
| | | .navbar-nav > li { |
| | | float: right; |
| | | } |
| | | } |
| | | @media (min-width: 768px) { |
| | | .navbar-left.flip { |
| | | float: right !important; |
| | | } |
| | | .navbar-right:last-child { |
| | | margin-left: -15px; |
| | | margin-right: auto; |
| | | } |
| | | .navbar-right.flip { |
| | | float: left !important; |
| | | margin-left: -15px; |
| | | margin-right: auto; |
| | | } |
| | | .navbar-right .dropdown-menu { |
| | | left: 0; |
| | | right: auto; |
| | | } |
| | | } |
| | | @media (min-width: 768px) { |
| | | .navbar-text { |
| | | float: right; |
| | | } |
| | | .navbar-text.navbar-right:last-child { |
| | | margin-left: 0; |
| | | margin-right: auto; |
| | | } |
| | | } |
| | | .pagination { |
| | | padding-right: 0; |
| | | } |
| | | .pagination > li > a, |
| | | .pagination > li > span { |
| | | float: right; |
| | | margin-right: -1px; |
| | | margin-left: 0px; |
| | | } |
| | | .pagination > li:first-child > a, |
| | | .pagination > li:first-child > span { |
| | | margin-left: 0; |
| | | border-bottom-right-radius: 4px; |
| | | border-top-right-radius: 4px; |
| | | border-bottom-left-radius: 0; |
| | | border-top-left-radius: 0; |
| | | } |
| | | .pagination > li:last-child > a, |
| | | .pagination > li:last-child > span { |
| | | margin-right: -1px; |
| | | border-bottom-left-radius: 4px; |
| | | border-top-left-radius: 4px; |
| | | border-bottom-right-radius: 0; |
| | | border-top-right-radius: 0; |
| | | } |
| | | .pager { |
| | | padding-right: 0; |
| | | padding-left: initial; |
| | | } |
| | | .pager .next > a, |
| | | .pager .next > span { |
| | | float: left; |
| | | } |
| | | .pager .previous > a, |
| | | .pager .previous > span { |
| | | float: right; |
| | | } |
| | | .nav-pills > li > a > .badge { |
| | | margin-left: 0px; |
| | | margin-right: 3px; |
| | | } |
| | | .list-group-item > .badge { |
| | | float: left; |
| | | } |
| | | .list-group-item > .badge + .badge { |
| | | margin-left: 5px; |
| | | margin-right: auto; |
| | | } |
| | | .alert-dismissable, |
| | | .alert-dismissible { |
| | | padding-left: 35px; |
| | | padding-right: 15px; |
| | | } |
| | | .alert-dismissable .close, |
| | | .alert-dismissible .close { |
| | | right: auto; |
| | | left: -21px; |
| | | } |
| | | .progress-bar { |
| | | float: right; |
| | | } |
| | | .media > .pull-left { |
| | | margin-right: 10px; |
| | | } |
| | | .media > .pull-left.flip { |
| | | margin-right: 0; |
| | | margin-left: 10px; |
| | | } |
| | | .media > .pull-right { |
| | | margin-left: 10px; |
| | | } |
| | | .media > .pull-right.flip { |
| | | margin-left: 0; |
| | | margin-right: 10px; |
| | | } |
| | | .media-right, |
| | | .media > .pull-right { |
| | | padding-right: 10px; |
| | | padding-left: initial; |
| | | } |
| | | .media-left, |
| | | .media > .pull-left { |
| | | padding-left: 10px; |
| | | padding-right: initial; |
| | | } |
| | | .media-list { |
| | | padding-right: 0; |
| | | padding-left: initial; |
| | | list-style: none; |
| | | } |
| | | .list-group { |
| | | padding-right: 0; |
| | | padding-left: initial; |
| | | } |
| | | .panel > .table:first-child > thead:first-child > tr:first-child td:first-child, |
| | | .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child, |
| | | .panel > .table:first-child > tbody:first-child > tr:first-child td:first-child, |
| | | .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child, |
| | | .panel > .table:first-child > thead:first-child > tr:first-child th:first-child, |
| | | .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child, |
| | | .panel > .table:first-child > tbody:first-child > tr:first-child th:first-child, |
| | | .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child { |
| | | border-top-right-radius: 3px; |
| | | border-top-left-radius: 0; |
| | | } |
| | | .panel > .table:first-child > thead:first-child > tr:first-child td:last-child, |
| | | .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child, |
| | | .panel > .table:first-child > tbody:first-child > tr:first-child td:last-child, |
| | | .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child, |
| | | .panel > .table:first-child > thead:first-child > tr:first-child th:last-child, |
| | | .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child, |
| | | .panel > .table:first-child > tbody:first-child > tr:first-child th:last-child, |
| | | .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child { |
| | | border-top-left-radius: 3px; |
| | | border-top-right-radius: 0; |
| | | } |
| | | .panel > .table:last-child > tbody:last-child > tr:last-child td:first-child, |
| | | .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child, |
| | | .panel > .table:last-child > tfoot:last-child > tr:last-child td:first-child, |
| | | .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child, |
| | | .panel > .table:last-child > tbody:last-child > tr:last-child th:first-child, |
| | | .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child, |
| | | .panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child, |
| | | .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child { |
| | | border-bottom-left-radius: 3px; |
| | | border-top-right-radius: 0; |
| | | } |
| | | .panel > .table:last-child > tbody:last-child > tr:last-child td:last-child, |
| | | .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child, |
| | | .panel > .table:last-child > tfoot:last-child > tr:last-child td:last-child, |
| | | .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child, |
| | | .panel > .table:last-child > tbody:last-child > tr:last-child th:last-child, |
| | | .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child, |
| | | .panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child, |
| | | .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child { |
| | | border-bottom-right-radius: 3px; |
| | | border-top-left-radius: 0; |
| | | } |
| | | .panel > .table-bordered > thead > tr > th:first-child, |
| | | .panel > .table-responsive > .table-bordered > thead > tr > th:first-child, |
| | | .panel > .table-bordered > tbody > tr > th:first-child, |
| | | .panel > .table-responsive > .table-bordered > tbody > tr > th:first-child, |
| | | .panel > .table-bordered > tfoot > tr > th:first-child, |
| | | .panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child, |
| | | .panel > .table-bordered > thead > tr > td:first-child, |
| | | .panel > .table-responsive > .table-bordered > thead > tr > td:first-child, |
| | | .panel > .table-bordered > tbody > tr > td:first-child, |
| | | .panel > .table-responsive > .table-bordered > tbody > tr > td:first-child, |
| | | .panel > .table-bordered > tfoot > tr > td:first-child, |
| | | .panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child { |
| | | border-right: 0; |
| | | border-left: none; |
| | | } |
| | | .panel > .table-bordered > thead > tr > th:last-child, |
| | | .panel > .table-responsive > .table-bordered > thead > tr > th:last-child, |
| | | .panel > .table-bordered > tbody > tr > th:last-child, |
| | | .panel > .table-responsive > .table-bordered > tbody > tr > th:last-child, |
| | | .panel > .table-bordered > tfoot > tr > th:last-child, |
| | | .panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child, |
| | | .panel > .table-bordered > thead > tr > td:last-child, |
| | | .panel > .table-responsive > .table-bordered > thead > tr > td:last-child, |
| | | .panel > .table-bordered > tbody > tr > td:last-child, |
| | | .panel > .table-responsive > .table-bordered > tbody > tr > td:last-child, |
| | | .panel > .table-bordered > tfoot > tr > td:last-child, |
| | | .panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child { |
| | | border-right: none; |
| | | border-left: 0; |
| | | } |
| | | .embed-responsive .embed-responsive-item, |
| | | .embed-responsive iframe, |
| | | .embed-responsive embed, |
| | | .embed-responsive object { |
| | | right: 0; |
| | | left: auto; |
| | | } |
| | | .close { |
| | | float: left; |
| | | } |
| | | .modal-footer { |
| | | text-align: left; |
| | | } |
| | | .modal-footer .btn + .btn { |
| | | margin-left: auto; |
| | | margin-right: 5px; |
| | | } |
| | | .modal-footer .btn-group .btn + .btn { |
| | | margin-right: -1px; |
| | | margin-left: auto; |
| | | } |
| | | .modal-footer .btn-block + .btn-block { |
| | | margin-right: 0; |
| | | margin-left: auto; |
| | | } |
| | | .popover { |
| | | left: auto; |
| | | text-align: right; |
| | | } |
| | | .popover.top > .arrow { |
| | | right: 50%; |
| | | left: auto; |
| | | margin-right: -11px; |
| | | margin-left: auto; |
| | | } |
| | | .popover.top > .arrow:after { |
| | | margin-right: -10px; |
| | | margin-left: auto; |
| | | } |
| | | .popover.bottom > .arrow { |
| | | right: 50%; |
| | | left: auto; |
| | | margin-right: -11px; |
| | | margin-left: auto; |
| | | } |
| | | .popover.bottom > .arrow:after { |
| | | margin-right: -10px; |
| | | margin-left: auto; |
| | | } |
| | | .carousel-control { |
| | | right: 0; |
| | | bottom: 0; |
| | | } |
| | | .carousel-control.left { |
| | | right: auto; |
| | | left: 0; |
| | | background-image: -webkit-linear-gradient(left, color-stop(rgba(0, 0, 0, 0.5) 0%), color-stop(rgba(0, 0, 0, 0.0001) 100%)); |
| | | background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%); |
| | | background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%); |
| | | background-repeat: repeat-x; |
| | | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1); |
| | | } |
| | | .carousel-control.right { |
| | | left: auto; |
| | | right: 0; |
| | | background-image: -webkit-linear-gradient(left, color-stop(rgba(0, 0, 0, 0.0001) 0%), color-stop(rgba(0, 0, 0, 0.5) 100%)); |
| | | background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%); |
| | | background-image: linear-gradient(to right, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%); |
| | | background-repeat: repeat-x; |
| | | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1); |
| | | } |
| | | .carousel-control .icon-prev, |
| | | .carousel-control .glyphicon-chevron-left { |
| | | left: 50%; |
| | | right: auto; |
| | | margin-right: -10px; |
| | | } |
| | | .carousel-control .icon-next, |
| | | .carousel-control .glyphicon-chevron-right { |
| | | right: 50%; |
| | | left: auto; |
| | | margin-left: -10px; |
| | | } |
| | | .carousel-indicators { |
| | | right: 50%; |
| | | left: 0; |
| | | margin-right: -30%; |
| | | margin-left: 0; |
| | | padding-left: 0; |
| | | } |
| | | @media screen and (min-width: 768px) { |
| | | .carousel-control .glyphicon-chevron-left, |
| | | .carousel-control .icon-prev { |
| | | margin-left: 0; |
| | | margin-right: -15px; |
| | | } |
| | | .carousel-control .glyphicon-chevron-right, |
| | | .carousel-control .icon-next { |
| | | margin-left: 0; |
| | | margin-right: -15px; |
| | | } |
| | | .carousel-caption { |
| | | left: 20%; |
| | | right: 20%; |
| | | padding-bottom: 30px; |
| | | } |
| | | } |
| | | .pull-right.flip { |
| | | float: left !important; |
| | | } |
| | | .pull-left.flip { |
| | | float: right !important; |
| | | } |
| | | /*# sourceMappingURL=bootstrap-rtl.css.map */ |
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-core/pom.xml
user/guns-core/src/main/java/com/supersavedriving/user/core/CoreFlag.java
user/guns-core/src/main/java/com/supersavedriving/user/core/aop/BaseControllerExceptionHandler.java
user/guns-core/src/main/java/com/supersavedriving/user/core/base/controller/BaseController.java
user/guns-core/src/main/java/com/supersavedriving/user/core/base/controller/GlobalController.java
user/guns-core/src/main/java/com/supersavedriving/user/core/base/controller/GunsErrorView.java
user/guns-core/src/main/java/com/supersavedriving/user/core/base/tips/ErrorTip.java
user/guns-core/src/main/java/com/supersavedriving/user/core/base/tips/SuccessTip.java
user/guns-core/src/main/java/com/supersavedriving/user/core/base/tips/Tip.java
user/guns-core/src/main/java/com/supersavedriving/user/core/base/warpper/BaseControllerWarpper.java
user/guns-core/src/main/java/com/supersavedriving/user/core/cache/BaseCacheFactory.java
user/guns-core/src/main/java/com/supersavedriving/user/core/cache/CacheKit.java
user/guns-core/src/main/java/com/supersavedriving/user/core/cache/EhcacheFactory.java
user/guns-core/src/main/java/com/supersavedriving/user/core/cache/ICache.java
user/guns-core/src/main/java/com/supersavedriving/user/core/cache/ILoader.java
user/guns-core/src/main/java/com/supersavedriving/user/core/config/DefaultFastjsonConfig.java
user/guns-core/src/main/java/com/supersavedriving/user/core/config/DefaultMultiConfig.java
user/guns-core/src/main/java/com/supersavedriving/user/core/config/DefaultProperties.java
user/guns-core/src/main/java/com/supersavedriving/user/core/config/DefaultWebConfig.java
user/guns-core/src/main/java/com/supersavedriving/user/core/config/properties/DruidProperties.java
user/guns-core/src/main/java/com/supersavedriving/user/core/config/properties/MutiDataSourceProperties.java
user/guns-core/src/main/java/com/supersavedriving/user/core/constant/IsMenu.java
user/guns-core/src/main/java/com/supersavedriving/user/core/datascope/DataScope.java
user/guns-core/src/main/java/com/supersavedriving/user/core/datascope/DataScopeInterceptor.java
user/guns-core/src/main/java/com/supersavedriving/user/core/db/Db.java
user/guns-core/src/main/java/com/supersavedriving/user/core/exception/GunsException.java
user/guns-core/src/main/java/com/supersavedriving/user/core/exception/GunsExceptionEnum.java
user/guns-core/src/main/java/com/supersavedriving/user/core/exception/ServiceExceptionEnum.java
user/guns-core/src/main/java/com/supersavedriving/user/core/mutidatasource/DataSourceContextHolder.java
user/guns-core/src/main/java/com/supersavedriving/user/core/mutidatasource/DynamicDataSource.java
user/guns-core/src/main/java/com/supersavedriving/user/core/mutidatasource/annotion/DataSource.java
user/guns-core/src/main/java/com/supersavedriving/user/core/mutidatasource/aop/MultiSourceExAop.java
user/guns-core/src/main/java/com/supersavedriving/user/core/node/MenuNode.java
user/guns-core/src/main/java/com/supersavedriving/user/core/node/ZTreeNode.java
user/guns-core/src/main/java/com/supersavedriving/user/core/page/PageBT.java
user/guns-core/src/main/java/com/supersavedriving/user/core/page/PageInfoBT.java
user/guns-core/src/main/java/com/supersavedriving/user/core/qr/ImgQrTool.java
user/guns-core/src/main/java/com/supersavedriving/user/core/qr/MatrixToImageConfig.java
user/guns-core/src/main/java/com/supersavedriving/user/core/qr/MatrixToImageWriter.java
user/guns-core/src/main/java/com/supersavedriving/user/core/qr/QrImage.java
user/guns-core/src/main/java/com/supersavedriving/user/core/support/BasicType.java
user/guns-core/src/main/java/com/supersavedriving/user/core/support/BeanKit.java
user/guns-core/src/main/java/com/supersavedriving/user/core/support/ClassKit.java
user/guns-core/src/main/java/com/supersavedriving/user/core/support/CollectionKit.java
user/guns-core/src/main/java/com/supersavedriving/user/core/support/DateTime.java
user/guns-core/src/main/java/com/supersavedriving/user/core/support/DateTimeKit.java
user/guns-core/src/main/java/com/supersavedriving/user/core/support/HexKit.java
user/guns-core/src/main/java/com/supersavedriving/user/core/support/HttpKit.java
user/guns-core/src/main/java/com/supersavedriving/user/core/support/ObjectKit.java
user/guns-core/src/main/java/com/supersavedriving/user/core/support/PageKit.java
user/guns-core/src/main/java/com/supersavedriving/user/core/support/StrKit.java
user/guns-core/src/main/java/com/supersavedriving/user/core/support/WafKit.java
user/guns-core/src/main/java/com/supersavedriving/user/core/support/WafRequestWrapper.java
user/guns-core/src/main/java/com/supersavedriving/user/core/support/exception/ToolBoxException.java
user/guns-core/src/main/java/com/supersavedriving/user/core/util/Convert.java
user/guns-core/src/main/java/com/supersavedriving/user/core/util/DateUtil.java
user/guns-core/src/main/java/com/supersavedriving/user/core/util/FileUtil.java
user/guns-core/src/main/java/com/supersavedriving/user/core/util/HttpSessionHolder.java
user/guns-core/src/main/java/com/supersavedriving/user/core/util/IdGenerator.java
user/guns-core/src/main/java/com/supersavedriving/user/core/util/MD5Util.java
user/guns-core/src/main/java/com/supersavedriving/user/core/util/NumUtil.java
user/guns-core/src/main/java/com/supersavedriving/user/core/util/PingYinUtil.java
user/guns-core/src/main/java/com/supersavedriving/user/core/util/RenderUtil.java
user/guns-core/src/main/java/com/supersavedriving/user/core/util/ResKit.java
user/guns-core/src/main/java/com/supersavedriving/user/core/util/SimpleContrast.java
user/guns-core/src/main/java/com/supersavedriving/user/core/util/SpringContextHolder.java
user/guns-core/src/main/java/com/supersavedriving/user/core/util/SqlUtil.java
user/guns-core/src/main/java/com/supersavedriving/user/core/util/ToolUtil.java
user/guns-core/src/main/java/com/supersavedriving/user/core/xss/XssFilter.java
user/guns-core/src/main/java/com/supersavedriving/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/supersavedriving/user/generator/action/GunsCodeGenerator.java
user/guns-generator/src/main/java/com/supersavedriving/user/generator/action/config/AbstractGeneratorConfig.java
user/guns-generator/src/main/java/com/supersavedriving/user/generator/action/config/GunsGeneratorConfig.java
user/guns-generator/src/main/java/com/supersavedriving/user/generator/action/config/WebGeneratorConfig.java
user/guns-generator/src/main/java/com/supersavedriving/user/generator/action/model/GenQo.java
user/guns-generator/src/main/java/com/supersavedriving/user/generator/engine/SimpleTemplateEngine.java
user/guns-generator/src/main/java/com/supersavedriving/user/generator/engine/base/AbstractTemplateEngine.java
user/guns-generator/src/main/java/com/supersavedriving/user/generator/engine/base/GunsTemplateEngine.java
user/guns-generator/src/main/java/com/supersavedriving/user/generator/engine/config/ContextConfig.java
user/guns-generator/src/main/java/com/supersavedriving/user/generator/engine/config/ControllerConfig.java
user/guns-generator/src/main/java/com/supersavedriving/user/generator/engine/config/DaoConfig.java
user/guns-generator/src/main/java/com/supersavedriving/user/generator/engine/config/Menu.java
user/guns-generator/src/main/java/com/supersavedriving/user/generator/engine/config/PageConfig.java
user/guns-generator/src/main/java/com/supersavedriving/user/generator/engine/config/ServiceConfig.java
user/guns-generator/src/main/java/com/supersavedriving/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 |