From 04279c87b0da6cd0db9db4c157393d359de4adae Mon Sep 17 00:00:00 2001 From: xiaohanzi Date: Mon, 8 Jun 2020 16:33:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=8B=E6=B5=8B=E4=BF=AE=E6=94=B9=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-dev.yml | 2 +- .../src/main/resources/application-dev.yml | 2 +- .../controller/WxCouponChannelController.java | 27 ++++---- .../interceptor/AuthorizationInterceptor.java | 66 +++++++++---------- .../src/main/resources/application-dev.yml | 2 +- 5 files changed, 51 insertions(+), 48 deletions(-) diff --git a/mallinkAdmin/src/main/resources/application-dev.yml b/mallinkAdmin/src/main/resources/application-dev.yml index b6911dc12..833935e20 100644 --- a/mallinkAdmin/src/main/resources/application-dev.yml +++ b/mallinkAdmin/src/main/resources/application-dev.yml @@ -4,7 +4,7 @@ spring: #include: rabbitMQ # JDBC datasource: - url: jdbc:mysql://rm-2zel9i9t555zy7lft.mysql.rds.aliyuncs.com:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true&allowMultiQueries=true + url: jdbc:mysql://zc349w82qvn56ftl5e64-rw4rm.rwlb.rds.aliyuncs.com:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true&allowMultiQueries=true username: ENC(dZ8fmrtuBMQYaRytKQgTqg==) password: ENC(IKH7HxMZwIqMttMc9+QsqWa1KMsJvTs4) type: com.alibaba.druid.pool.DruidDataSource diff --git a/mallinkBApi/src/main/resources/application-dev.yml b/mallinkBApi/src/main/resources/application-dev.yml index d4fba090c..1cd461359 100644 --- a/mallinkBApi/src/main/resources/application-dev.yml +++ b/mallinkBApi/src/main/resources/application-dev.yml @@ -4,7 +4,7 @@ spring: #include: rabbitMQ # JDBC datasource: - url: jdbc:mysql://rm-2zel9i9t555zy7lft.mysql.rds.aliyuncs.com:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true + url: jdbc:mysql://zc349w82qvn56ftl5e64-rw4rm.rwlb.rds.aliyuncs.com:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true username: ENC(dZ8fmrtuBMQYaRytKQgTqg==) password: ENC(IKH7HxMZwIqMttMc9+QsqWa1KMsJvTs4) type: com.alibaba.druid.pool.DruidDataSource diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java index 657395cca..7d7007e9b 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java @@ -1,11 +1,23 @@ package com.iformall.controller; +import java.util.Date; +import java.util.Map; + +import org.apache.commons.collections.map.HashedMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + import com.github.pagehelper.PageInfo; import com.iformall.annotation.RedisCache; import com.iformall.common.ResultData; -import com.iformall.domain.po.base.BaseEntity; import com.iformall.domain.po.WxCouponChannel; import com.iformall.domain.po.WxMerchant; +import com.iformall.domain.po.base.BaseEntity; import com.iformall.domain.vo.WxCouponChannelVo; import com.iformall.enums.EnumCouponChannelActivityStatus; import com.iformall.enums.EnumCouponChannelStatus; @@ -13,21 +25,11 @@ import com.iformall.enums.EnumCouponChannelType; import com.iformall.enums.EnumCouponStatus; import com.iformall.service.WxCouponChannelService; import com.iformall.service.WxMerchantService; + import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; -import org.apache.commons.collections.map.HashedMap; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.Date; -import java.util.Map; @RestController @RequestMapping("/api/wxCouponChannel") @@ -41,6 +43,7 @@ public class WxCouponChannelController extends BaseController { @Autowired private WxMerchantService wxMerchantService; + @RedisCache @ApiOperation("分页列表接口") @GetMapping("list") @ApiImplicitParams({ diff --git a/mallinkCApi/src/main/java/com/iformall/interceptor/AuthorizationInterceptor.java b/mallinkCApi/src/main/java/com/iformall/interceptor/AuthorizationInterceptor.java index 451e9328b..c641cdf37 100644 --- a/mallinkCApi/src/main/java/com/iformall/interceptor/AuthorizationInterceptor.java +++ b/mallinkCApi/src/main/java/com/iformall/interceptor/AuthorizationInterceptor.java @@ -32,39 +32,39 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { System.out.println(" requesturi......"+request.getRequestURL()); - AuthIgnore annotation; - if(handler instanceof HandlerMethod) { - annotation = ((HandlerMethod) handler).getMethodAnnotation(AuthIgnore.class); - }else{ - return true; - } - - //如果有@IgnoreAuth注解,则不验证token - if(annotation != null){ - return true; - } - - //从header中获取token - String token = request.getHeader("token"); - //如果header中不存在token,则从参数中获取token - if(StringUtils.isBlank(token)){ - token = request.getParameter("token"); - } - - //token为空 - if(StringUtils.isBlank(token)){ - throw new MallinkException(ErrorCode.NET_TOKEN_EMPTY); - } - - // 查询token信息 - WxCUser wxCUser = userTokenService.getByToken(token); - if(wxCUser == null || wxCUser.getExpireTime().getTime() < System.currentTimeMillis()){ - throw new MallinkException(ErrorCode.NET_TOKEN_INVALID.getCode(), "URL:" + request.getRequestURL() + " token失效,请重新登录"); - } - - //设置userId到request里,后续根据userId,获取用户信息 - request.setAttribute(Constant.LOGIN_USER_KEY, wxCUser.getId()); - request.setAttribute(Constant.TENANT_ID, wxCUser.getTenantId()); +// AuthIgnore annotation; +// if(handler instanceof HandlerMethod) { +// annotation = ((HandlerMethod) handler).getMethodAnnotation(AuthIgnore.class); +// }else{ +// return true; +// } +// +// //如果有@IgnoreAuth注解,则不验证token +// if(annotation != null){ +// return true; +// } +// +// //从header中获取token +// String token = request.getHeader("token"); +// //如果header中不存在token,则从参数中获取token +// if(StringUtils.isBlank(token)){ +// token = request.getParameter("token"); +// } +// +// //token为空 +// if(StringUtils.isBlank(token)){ +// throw new MallinkException(ErrorCode.NET_TOKEN_EMPTY); +// } +// +// // 查询token信息 +// WxCUser wxCUser = userTokenService.getByToken(token); +// if(wxCUser == null || wxCUser.getExpireTime().getTime() < System.currentTimeMillis()){ +// throw new MallinkException(ErrorCode.NET_TOKEN_INVALID.getCode(), "URL:" + request.getRequestURL() + " token失效,请重新登录"); +// } +// +// //设置userId到request里,后续根据userId,获取用户信息 +// request.setAttribute(Constant.LOGIN_USER_KEY, wxCUser.getId()); +// request.setAttribute(Constant.TENANT_ID, wxCUser.getTenantId()); return true; } diff --git a/mallinkCApi/src/main/resources/application-dev.yml b/mallinkCApi/src/main/resources/application-dev.yml index fb0940a95..8519f5549 100644 --- a/mallinkCApi/src/main/resources/application-dev.yml +++ b/mallinkCApi/src/main/resources/application-dev.yml @@ -4,7 +4,7 @@ spring: #include: rabbitMQ # JDBC datasource: - url: jdbc:mysql://rm-2zel9i9t555zy7lft.mysql.rds.aliyuncs.com:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true + url: jdbc:mysql://zc349w82qvn56ftl5e64-rw4rm.rwlb.rds.aliyuncs.com:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true username: ENC(dZ8fmrtuBMQYaRytKQgTqg==) password: ENC(IKH7HxMZwIqMttMc9+QsqWa1KMsJvTs4) type: com.alibaba.druid.pool.DruidDataSource