# request-check **Repository Path**: loubobooo/request-check ## Basic Information - **Project Name**: request-check - **Description**: 基于annotation的http请求去重插件 - **Primary Language**: Unknown - **License**: GPL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2018-08-14 - **Last Updated**: 2021-08-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 开发 # 预览 ![重复请求号01.jpg](https://ooo.0o0.ooo/2017/05/24/59245e69e35d5.jpg) ![重复请求号02.jpg](https://ooo.0o0.ooo/2017/05/24/59245e6a643ea.jpg) ![重复请求号03.jpg](https://ooo.0o0.ooo/2017/05/24/59245e6b55994.jpg) # 简介 基于annotation的http去重插件: - `Redis`保存请求。 - `Spring AOP` 进行切面。 **后续会用`Spring Boot`重构** # 安装 ``` git clone https://gitee.com/loubobooo/request-check.git ``` ``` cd request-check ``` ``` mvn clean ``` ``` mvn install ``` # 使用 ## 加入依赖 ```xml com.crossoverJie SSM-REQUEST-CHECK 1.0.0 ``` ## 开启CGLIB代理 > 需要根据自己`web.xml`中定义的 ```xml SpringMVC org.springframework.web.servlet.DispatcherServlet contextConfigLocation classpath:spring-mvc.xml 1 true ``` `spring-mvc.xml`文件中配置: ```xml ``` ## 使用注解 ```java @CheckReqNo @RequestMapping(value = "/createRedisContent",method = RequestMethod.POST) @ResponseBody public BaseResponse createRedisContent(@RequestBody RedisContentReq redisContentReq){ BaseResponse response = new BaseResponse() ; Rediscontent rediscontent = new Rediscontent() ; try { CommonUtil.setLogValueModelToModel(redisContentReq,rediscontent); rediscontentMapper.insertSelective(rediscontent) ; response.setReqNo(redisContentReq.getReqNo()); response.setCode(StatusEnum.SUCCESS.getCode()); response.setMessage(StatusEnum.SUCCESS.getMessage()); }catch (Exception e){ logger.error("system error",e); response.setReqNo(response.getReqNo()); response.setCode(StatusEnum.FAIL.getCode()); response.setMessage(StatusEnum.FAIL.getMessage()); } return response ; } ``` ## 自定义缓存前缀、时间 > 默认缓存前缀是`reqNo`,时间为1天。 ``` #redis前缀 redis.prefixReq=reqNo #redis缓存时间 默认单位为天 redis.day=1 ```