接口文档整理
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
package co.yixiang.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
@ -19,9 +20,13 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
public class SwaggerConfiguration {
|
||||
@Value("${swagger.enabled}")
|
||||
private Boolean enabled;
|
||||
|
||||
@Bean
|
||||
public Docket createRestApi() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.enable(enabled)
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("co.yixiang.modules"))
|
||||
@ -31,11 +36,11 @@ public class SwaggerConfiguration {
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title("Yshop商城API")
|
||||
.description("Yshop商城API")
|
||||
.termsOfServiceUrl("http://localhost:8009/")
|
||||
.title("yshop商城移动端API")
|
||||
.description("yshop商城移动端API")
|
||||
.termsOfServiceUrl("http://localhost:8009/api")
|
||||
.contact("610796224@qq.com")
|
||||
.version("1.0")
|
||||
.version("1.6")
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package co.yixiang.modules.monitor.rest;
|
||||
|
||||
import co.yixiang.annotation.Limit;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -13,6 +15,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("api")
|
||||
@Api(value = "接口限流测试", tags = "接口限流测试", description = "接口限流测试")
|
||||
public class LimitController {
|
||||
private static final AtomicInteger ATOMIC_INTEGER = new AtomicInteger();
|
||||
|
||||
@ -21,6 +24,7 @@ public class LimitController {
|
||||
*/
|
||||
@Limit(key = "test", period = 60, count = 10, name = "testLimit", prefix = "limit")
|
||||
@GetMapping("/limit")
|
||||
@ApiOperation(value = "测试示例",notes = "测试示例")
|
||||
public int testLimit() {
|
||||
return ATOMIC_INTEGER.incrementAndGet();
|
||||
}
|
||||
|
@ -1,47 +0,0 @@
|
||||
package co.yixiang.modules.monitor.rest;
|
||||
|
||||
import co.yixiang.modules.monitor.domain.vo.RedisVo;
|
||||
import co.yixiang.modules.monitor.service.RedisService;
|
||||
import co.yixiang.aop.log.Log;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2018-12-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("api")
|
||||
public class RedisController {
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Log("查询Redis缓存")
|
||||
@GetMapping(value = "/redis")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','REDIS_ALL','REDIS_SELECT')")
|
||||
public ResponseEntity getRedis(String key, Pageable pageable){
|
||||
return new ResponseEntity(redisService.findByKey(key,pageable), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("删除Redis缓存")
|
||||
@DeleteMapping(value = "/redis")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','REDIS_ALL','REDIS_DELETE')")
|
||||
public ResponseEntity delete(@RequestBody RedisVo resources){
|
||||
redisService.delete(resources.getKey());
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("清空Redis缓存")
|
||||
@DeleteMapping(value = "/redis/all")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','REDIS_ALL','REDIS_DELETE')")
|
||||
public ResponseEntity deleteAll(){
|
||||
redisService.flushdb();
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
package co.yixiang.modules.monitor.rest;
|
||||
|
||||
import co.yixiang.modules.monitor.service.VisitsService;
|
||||
import co.yixiang.utils.RequestHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2018-12-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("api")
|
||||
public class VisitsController {
|
||||
|
||||
@Autowired
|
||||
private VisitsService visitsService;
|
||||
|
||||
@PostMapping(value = "/visits")
|
||||
public ResponseEntity create(){
|
||||
visitsService.count(RequestHolder.getHttpServletRequest());
|
||||
return new ResponseEntity(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/visits")
|
||||
public ResponseEntity get(){
|
||||
return new ResponseEntity(visitsService.get(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/visits/chartData")
|
||||
public ResponseEntity getChartData(){
|
||||
return new ResponseEntity(visitsService.getChartData(),HttpStatus.OK);
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ import co.yixiang.utils.EncryptUtils;
|
||||
import co.yixiang.utils.OrderUtil;
|
||||
import co.yixiang.utils.SecurityUtils;
|
||||
import com.vdurmont.emoji.EmojiParser;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import co.yixiang.aop.log.Log;
|
||||
@ -45,6 +46,7 @@ import java.util.Map;
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(value = "H5认证模块", tags = "H5认证模块", description = "H5认证模块")
|
||||
public class AuthenticationController extends BaseController {
|
||||
|
||||
@Value("${jwt.header}")
|
||||
@ -71,6 +73,7 @@ public class AuthenticationController extends BaseController {
|
||||
*/
|
||||
@Log("用户登录")
|
||||
@PostMapping(value = "${jwt.auth.path}")
|
||||
@ApiOperation(value = "用户登录",notes = "用户登录")
|
||||
public ApiResult<Map<String,String>> login(@Validated @RequestBody AuthorizationUser authorizationUser){
|
||||
|
||||
final JwtUser jwtUser = (JwtUser) userDetailsService.loadUserByUsername(authorizationUser.getAccount());
|
||||
@ -173,6 +176,7 @@ public class AuthenticationController extends BaseController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/auth/logout")
|
||||
@ApiOperation(value = "退出登录",notes = "退出登录")
|
||||
public ApiResult logout(){
|
||||
return ApiResult.ok("退出成功");
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import javax.validation.Valid;
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api("商品分类表 API")
|
||||
@Api(value = "商品分类", tags = "商品分类", description = "商品分类")
|
||||
public class StoreCategoryController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
|
@ -23,6 +23,8 @@ import co.yixiang.mp.utils.JsonUtils;
|
||||
import co.yixiang.utils.EncryptUtils;
|
||||
import co.yixiang.utils.OrderUtil;
|
||||
import co.yixiang.utils.RedisUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.chanjar.weixin.common.bean.WxAccessToken;
|
||||
import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder;
|
||||
@ -50,6 +52,7 @@ import java.util.concurrent.locks.Lock;
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
@Api(value = "微信小程序", tags = "微信小程序", description = "微信小程序")
|
||||
public class WxMaUserController {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
private final WxMaService wxMaService;
|
||||
@ -66,6 +69,7 @@ public class WxMaUserController {
|
||||
* 小程序登陆接口
|
||||
*/
|
||||
@PostMapping("/wechat/mp_auth")
|
||||
@ApiOperation(value = "小程序登陆",notes = "小程序登陆")
|
||||
public ApiResult<Object> login(@RequestParam(value = "code") String code,
|
||||
@RequestParam(value = "spread") String spread,
|
||||
@RequestParam(value = "encryptedData") String encryptedData,
|
||||
|
Reference in New Issue
Block a user