mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2025-12-29 16:05:31 +08:00
knife4j升级4.3.0注解改造
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
package org.jeecg.modules.test.feign.controller;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
@ -8,8 +10,6 @@ import org.jeecg.modules.test.feign.client.JeecgTestClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.alibaba.csp.sentinel.annotation.SentinelResource;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* 微服务单元测试
|
||||
@ -19,7 +19,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/test")
|
||||
@Api(tags = "【微服务】单元测试")
|
||||
@Tag(name = "【微服务】单元测试")
|
||||
public class JeecgTestFeignController {
|
||||
|
||||
@Autowired
|
||||
@ -32,7 +32,7 @@ public class JeecgTestFeignController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getMessage")
|
||||
@ApiOperation(value = "测试feign调用demo服务1", notes = "测试feign @SentinelResource熔断写法 | 测试熔断关闭jeecg-demo服务")
|
||||
@Operation(summary = "测试feign @SentinelResource熔断写法 | 测试熔断关闭jeecg-demo服务")
|
||||
@SentinelResource(value = "test_more_getMessage", fallback = "getDefaultUser")
|
||||
public Result<String> getMessage(@RequestParam(value = "name", required = false) String name) {
|
||||
log.info("---------Feign fallbackFactory优先级高于@SentinelResource-----------------");
|
||||
@ -47,7 +47,7 @@ public class JeecgTestFeignController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getMessage2")
|
||||
@ApiOperation(value = "测试feign调用demo服务2", notes = "测试feign fallbackFactory熔断写法 | 测试熔断关闭jeecg-demo服务")
|
||||
@Operation(summary = "测试feign fallbackFactory熔断写法 | 测试熔断关闭jeecg-demo服务")
|
||||
public Result<String> getMessage2(@RequestParam(value = "name", required = false) String name) {
|
||||
log.info("---------测试 Feign fallbackFactory-----------------");
|
||||
String resultMsg = jeecgTestClient.getMessage(" I am jeecg-system 服务节点,呼叫 jeecg-demo!");
|
||||
@ -56,7 +56,7 @@ public class JeecgTestFeignController {
|
||||
|
||||
|
||||
@GetMapping("/fallback")
|
||||
@ApiOperation(value = "测试熔断", notes = "测试熔断")
|
||||
@Operation(summary = "测试熔断")
|
||||
@SentinelResource(value = "test_more_fallback", fallback = "getDefaultUser")
|
||||
public Result<Object> test(@RequestParam(value = "name", required = false) String name) {
|
||||
if (StringUtils.isEmpty(name)) {
|
||||
|
||||
@ -3,6 +3,8 @@ package org.jeecg.modules.test.rabbitmq.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.jeecg.boot.starter.rabbitmq.client.RabbitMqClient;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.base.BaseMap;
|
||||
@ -13,8 +15,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
|
||||
/**
|
||||
@ -24,7 +24,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/test")
|
||||
@Api(tags = "【微服务】MQ单元测试")
|
||||
@Tag(name = "【微服务】MQ单元测试")
|
||||
public class JeecgMqTestController {
|
||||
|
||||
@Autowired
|
||||
@ -39,7 +39,7 @@ public class JeecgMqTestController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/rabbitmq")
|
||||
@ApiOperation(value = "测试rabbitmq", notes = "测试rabbitmq")
|
||||
@Operation(summary = "测试rabbitmq")
|
||||
public Result<?> rabbitMqClientTest(HttpServletRequest req) {
|
||||
//rabbitmq消息队列测试
|
||||
BaseMap map = new BaseMap();
|
||||
@ -50,7 +50,7 @@ public class JeecgMqTestController {
|
||||
}
|
||||
|
||||
@GetMapping(value = "/rabbitmq2")
|
||||
@ApiOperation(value = "rabbitmq消息总线测试", notes = "rabbitmq消息总线测试")
|
||||
@Operation(summary = "rabbitmq消息总线测试")
|
||||
public Result<?> rabbitmq2(HttpServletRequest req) {
|
||||
|
||||
//rabbitmq消息总线测试
|
||||
|
||||
@ -6,9 +6,8 @@ package org.jeecg.modules.test.seata.order.controller;
|
||||
* @date: 2022/01/24
|
||||
* @version: V1.0
|
||||
*/
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.jeecg.modules.test.seata.order.dto.PlaceOrderRequest;
|
||||
import org.jeecg.modules.test.seata.order.service.SeataOrderService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -20,7 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/test/seata/order")
|
||||
@Api(tags = "seata测试")
|
||||
@Tag(name = "seata测试")
|
||||
public class SeataOrderController {
|
||||
|
||||
@Autowired
|
||||
@ -30,7 +29,7 @@ public class SeataOrderController {
|
||||
* 自由下单
|
||||
*/
|
||||
@PostMapping("/placeOrder")
|
||||
@ApiOperation(value = "自由下单", notes = "自由下单")
|
||||
@Operation(summary = "自由下单")
|
||||
public String placeOrder(@Validated @RequestBody PlaceOrderRequest request) {
|
||||
orderService.placeOrder(request);
|
||||
return "下单成功";
|
||||
@ -40,7 +39,7 @@ public class SeataOrderController {
|
||||
* 测试商品库存不足-异常回滚
|
||||
*/
|
||||
@PostMapping("/test1")
|
||||
@ApiOperation(value = "测试商品库存不足", notes = "测试商品库存不足")
|
||||
@Operation(summary = "测试商品库存不足")
|
||||
public String test1() {
|
||||
//商品单价10元,库存20个,用户余额50元,模拟一次性购买22个。 期望异常回滚
|
||||
orderService.placeOrder(new PlaceOrderRequest(1L, 1L, 22));
|
||||
@ -51,7 +50,7 @@ public class SeataOrderController {
|
||||
* 测试用户账户余额不足-异常回滚
|
||||
*/
|
||||
@PostMapping("/test2")
|
||||
@ApiOperation(value = "测试用户账户余额不足", notes = "测试用户账户余额不足")
|
||||
@Operation(summary = "测试用户账户余额不足")
|
||||
public String test2() {
|
||||
//商品单价10元,库存20个,用户余额50元,模拟一次性购买6个。 期望异常回滚
|
||||
orderService.placeOrder(new PlaceOrderRequest(1L, 1L, 6));
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package org.jeecg.modules.test.sharding.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
@ -10,8 +12,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
@ -21,7 +21,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "分库分表测试")
|
||||
@Tag(name = "分库分表测试")
|
||||
@RestController
|
||||
@RequestMapping("/sharding")
|
||||
public class JeecgShardingDemoController extends JeecgController<ShardingSysLog, IShardingSysLogService> {
|
||||
@ -33,7 +33,7 @@ public class JeecgShardingDemoController extends JeecgController<ShardingSysLog,
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/test1")
|
||||
@ApiOperation(value = "单库分表插入", notes = "单库分表")
|
||||
@Operation(summary = "单库分表")
|
||||
public Result<?> add() {
|
||||
log.info("---------------------------------单库分表插入--------------------------------");
|
||||
int size = 10;
|
||||
@ -52,7 +52,7 @@ public class JeecgShardingDemoController extends JeecgController<ShardingSysLog,
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/list1")
|
||||
@ApiOperation(value = "单库分表查询", notes = "单库分表")
|
||||
@Operation(summary = "单库分表")
|
||||
public Result<?> list() {
|
||||
return Result.OK(shardingSysLogService.list());
|
||||
}
|
||||
@ -62,7 +62,7 @@ public class JeecgShardingDemoController extends JeecgController<ShardingSysLog,
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/test2")
|
||||
@ApiOperation(value = "分库分表插入", notes = "分库分表")
|
||||
@Operation(summary = "分库分表")
|
||||
public Result<?> test2() {
|
||||
int start=20;
|
||||
int size=30;
|
||||
@ -81,7 +81,7 @@ public class JeecgShardingDemoController extends JeecgController<ShardingSysLog,
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/list2")
|
||||
@ApiOperation(value = "分库分表查询", notes = "分库分表")
|
||||
@Operation(summary = "分库分表")
|
||||
public Result<?> list2() {
|
||||
return Result.OK(shardingSysLogService.list());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user