diff --git a/pom.xml b/pom.xml index b14ef93..da341d3 100644 --- a/pom.xml +++ b/pom.xml @@ -10,11 +10,10 @@ zteits_daily_report Demo project for Spring Boot - org.springframework.boot spring-boot-starter-parent - 1.5.2.RELEASE + 1.5.9.RELEASE @@ -33,10 +32,6 @@ org.springframework.boot - spring-boot-starter - - - org.springframework.boot spring-boot-starter-test test @@ -49,9 +44,9 @@ spring-boot-starter-aop - org.springframework.boot - spring-boot-starter-redis - 1.4.7.RELEASE + org.springframework.boot + spring-boot-starter-redis + 1.4.7.RELEASE @@ -77,17 +72,17 @@ hutool-all ${hutool-all.version} - + org.mybatis mybatis ${org.mybatis.version} - com.github.pagehelper - pagehelper-spring-boot-starter - ${pagehelper-spring-boot-starter.version} - + com.github.pagehelper + pagehelper-spring-boot-starter + ${pagehelper-spring-boot-starter.version} + com.alibaba druid @@ -98,7 +93,7 @@ fastjson 1.2.47 - + io.springfox springfox-swagger2 @@ -110,26 +105,44 @@ 2.7.0 - org.springframework.security - spring-security-web + org.springframework.security + spring-security-web - compile - zteits-oa + zteits-oa - - org.springframework.boot - spring-boot-maven-plugin - - com.zteits.oa.DailyReportApplication - - 1.3.5.RELEASE - - + + org.springframework.boot + spring-boot-maven-plugin + + com.zteits.oa.DailyReportApplication + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + diff --git a/src/main/java/com/zteits/oa/configuration/WebMvcConfig.java b/src/main/java/com/zteits/oa/configuration/WebMvcConfig.java index 3b4d63a..94582a6 100644 --- a/src/main/java/com/zteits/oa/configuration/WebMvcConfig.java +++ b/src/main/java/com/zteits/oa/configuration/WebMvcConfig.java @@ -2,7 +2,8 @@ package com.zteits.oa.configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; @@ -17,8 +18,13 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter { private Logger logger = LoggerFactory.getLogger(WebMvcConfig.class); - @Autowired - private AuthInterceptor authInterceptor; + @Bean + AuthInterceptor myInterceptor(){ + return new AuthInterceptor(); + } + + + @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { @@ -34,8 +40,9 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter { */ @Override public void addInterceptors(InterceptorRegistry registry) { + System.out.println("--begin 执行拦截器addInterceptors方法..."); //添加验证拦截器 - registry.addInterceptor(authInterceptor) + registry.addInterceptor(myInterceptor()) .addPathPatterns("/**") .excludePathPatterns("/oauth/**") .excludePathPatterns("/selectItem/**") @@ -43,6 +50,8 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter { .excludePathPatterns("/swagger-resources/**") .excludePathPatterns("/v2/**"); } + + } diff --git a/src/main/java/com/zteits/oa/configuration/auth/AuthInterceptor.java b/src/main/java/com/zteits/oa/configuration/auth/AuthInterceptor.java index c3d9b82..8a380ce 100644 --- a/src/main/java/com/zteits/oa/configuration/auth/AuthInterceptor.java +++ b/src/main/java/com/zteits/oa/configuration/auth/AuthInterceptor.java @@ -35,7 +35,7 @@ import com.zteits.oa.api.dto.asraop.LoginOathRes; * ---------------------------------------------------------* * 2017/5/11 atao v1.0.0 创建 */ -@Component +//@Component public class AuthInterceptor extends HandlerInterceptorAdapter { private static final Logger log = LoggerFactory.getLogger(AuthInterceptor.class); diff --git a/src/main/java/com/zteits/oa/configuration/swagger/SwaggerConfigAuto.java b/src/main/java/com/zteits/oa/configuration/swagger/SwaggerConfigAuto.java index 77d5acb..870f35d 100644 --- a/src/main/java/com/zteits/oa/configuration/swagger/SwaggerConfigAuto.java +++ b/src/main/java/com/zteits/oa/configuration/swagger/SwaggerConfigAuto.java @@ -16,7 +16,7 @@ import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; @Configuration // 配置注解,自动在本类上下文加载一些环境变量信息 @EnableSwagger2 // 使swagger2生效 -public class SwaggerConfigAuto extends WebMvcConfigurationSupport{ +public class SwaggerConfigAuto{ @Bean public Docket buildDocket(){ diff --git a/src/main/java/com/zteits/oa/report/web/AsraDailyController.java b/src/main/java/com/zteits/oa/report/web/AsraDailyController.java index a7ccd0a..74e690c 100644 --- a/src/main/java/com/zteits/oa/report/web/AsraDailyController.java +++ b/src/main/java/com/zteits/oa/report/web/AsraDailyController.java @@ -48,7 +48,7 @@ public class AsraDailyController { /**1.根据当前登录人查询登录人下面管理的员工-缓存中获取*/ AsraOpDTO asraOpDTO = (AsraOpDTO)request.getSession().getAttribute(SessionEnum.USER_INFO.key()); if(asraOpDTO == null){ - throw new BizException(ErrorType.AUTH_TOKEN_NOT_EXISTS,"session过期或者已经失效"); + throw new BizException(ErrorType.PARAMM_NULL,"session过期或者已经失效"); } /**2.判断登录人和时间查询日报*/ Date dailyDate = DateUtil.parseDate(asraDailyQueryReq.getDailyDate()); @@ -73,7 +73,7 @@ public class AsraDailyController { logger.info("--begin工时查询-当天填报人数统计(汇总),入参={}",JSONObject.toJSON(request)); AsraOpDTO asraOpDTO = (AsraOpDTO)servletRequest.getSession().getAttribute(SessionEnum.USER_INFO.key()); if(asraOpDTO == null ){ - throw new BizException(ErrorType.AUTH_TOKEN_NOT_EXISTS,"获取session为空"); + throw new BizException(ErrorType.PARAMM_NULL,"获取session为空"); } request.setOpIds(asraOpDTO.getOpIds()); BizResult result = asraDailyQueryService.queryAsraDailyOpNumForCurrentDay(request); @@ -94,7 +94,7 @@ public class AsraDailyController { logger.info("--begin工时查询-所有员工及自己或者自己日报,入参={}",JSONObject.toJSON(request)); AsraOpDTO asraOpDTO = (AsraOpDTO)servletRequest.getSession().getAttribute(SessionEnum.USER_INFO.key()); if(asraOpDTO == null ){ - throw new BizException(ErrorType.AUTH_TOKEN_NOT_EXISTS,"获取session为空"); + throw new BizException(ErrorType.PARAMM_NULL,"获取session为空"); } request.setOpIds(asraOpDTO.getOpIds()); BizResult result = asraDailyQueryService.queryAsraDailyAllForList(request); @@ -110,7 +110,7 @@ public class AsraDailyController { /**1.根据当前登录人查询登录人下面管理的员工-缓存中获取*/ AsraOpDTO asraOpDTO = (AsraOpDTO)request.getSession().getAttribute(SessionEnum.USER_INFO.key()); if(asraOpDTO == null ){ - throw new BizException(ErrorType.AUTH_TOKEN_NOT_EXISTS,"获取session为空"); + throw new BizException(ErrorType.PARAMM_NULL,"获取session为空"); } /**2.判断登录人和时间查询日报*/ Date dailyDate = DateUtil.parseDate(asraDailySaveOrUpdateReq.getDailyDate()); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 19d3d01..9b42b21 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -12,12 +12,14 @@ local.base.url=http://pay.service.rnting.com druid.driverClass=com.mysql.jdbc.Driver -druid.url=jdbc:mysql://192.168.1.167:3306/zt_asra?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true -druid.username=root -druid.password=root -#druid.url=jdbc:mysql://47.96.41.38:3306/zt_order_n?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true -#druid.username=order -#druid.password=MySQL5.7@123 +#druid.url=jdbc:mysql://192.168.1.167:3306/zt_asra?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true +#druid.username=root +#druid.password=root +druid.url=jdbc:mysql://47.96.41.38:3306/zt_asra?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true +druid.username=asra +druid.password=MySQL57@123 + + druid.initialSize=1 druid.minIdle=1