supportedMediaTypes = Lists.newArrayList();
- supportedMediaTypes.add(MediaType.APPLICATION_JSON);
- fastConverter.setSupportedMediaTypes(supportedMediaTypes);
- return new HttpMessageConverters(fastConverter);
- }
}
diff --git a/austin-web/src/main/java/com/java3y/austin/web/config/SwaggerConfiguration.java b/austin-web/src/main/java/com/java3y/austin/web/config/SwaggerConfiguration.java
index f3b543e..df5db05 100644
--- a/austin-web/src/main/java/com/java3y/austin/web/config/SwaggerConfiguration.java
+++ b/austin-web/src/main/java/com/java3y/austin/web/config/SwaggerConfiguration.java
@@ -1,56 +1,11 @@
package com.java3y.austin.web.config;
-import io.swagger.annotations.ApiModel;
-import org.springframework.context.annotation.Bean;
-import org.springframework.stereotype.Component;
-import springfox.documentation.builders.ApiInfoBuilder;
-import springfox.documentation.builders.RequestHandlerSelectors;
-import springfox.documentation.oas.annotations.EnableOpenApi;
-import springfox.documentation.service.ApiInfo;
-import springfox.documentation.service.Contact;
-import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spring.web.plugins.Docket;
-
+import org.springframework.context.annotation.Configuration;
/**
- * swagger配置类
- *
- * @author 3y
+ * OpenAPI 使用 springdoc 自动配置,无需手写 Docket。
+ * 访问:/swagger-ui/index.html 或 /v3/api-docs
*/
-@Component
-@EnableOpenApi
-@ApiModel
+@Configuration
public class SwaggerConfiguration {
- /**
- * 对C端用户的接口文档
- *
- * 地址:http://localhost:8080/swagger-ui/index.html
- *
- * @return
- */
- @Bean
- public Docket webApiDoc() {
- return new Docket(DocumentationType.OAS_30)
- .groupName("用户端接口文档")
- .pathMapping("/")
- //定义是否开启Swagger,false是关闭,可以通过变量去控制,线上关闭
- .enable(true)
- //配置文档的元信息
- .apiInfo(apiInfo())
- .select()
- .apis(RequestHandlerSelectors.basePackage("com.java3y.austin.web.controller"))
- //正则匹配请求路径,并分配到当前项目组
- //.paths(PathSelectors.ant("/api/**"))
- .build();
- }
-
- private ApiInfo apiInfo() {
- return new ApiInfoBuilder()
- .title("austin平台")
- .description("消息推送接口接口文档")
- .contact(new Contact("3y", "http://gitee.com/zhongfucheng/austin", "403686131@qq.com"))
- .version("v1.0")
- .build();
- }
-
}
\ No newline at end of file
diff --git a/austin-web/src/main/java/com/java3y/austin/web/controller/AlipayMiniProgramController.java b/austin-web/src/main/java/com/java3y/austin/web/controller/AlipayMiniProgramController.java
index 129580b..8977438 100644
--- a/austin-web/src/main/java/com/java3y/austin/web/controller/AlipayMiniProgramController.java
+++ b/austin-web/src/main/java/com/java3y/austin/web/controller/AlipayMiniProgramController.java
@@ -18,8 +18,8 @@ import com.java3y.austin.web.annotation.AustinResult;
import com.java3y.austin.web.exception.CommonException;
import com.java3y.austin.web.utils.Convert4Amis;
import com.java3y.austin.web.vo.amis.CommonAmisVo;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -40,14 +40,14 @@ import java.util.Objects;
@AustinAspect
@RestController
@RequestMapping("/alipayMiniProgram")
-@Api("支付宝小程序")
+@Tag(name = "支付宝小程序")
public class AlipayMiniProgramController {
@Autowired
private AccountUtils accountUtils;
@GetMapping("/template/list")
- @ApiOperation("/根据账号Id获取模板列表")
+ @Operation(summary = "/根据账号Id获取模板列表")
@AustinResult
public List queryList(Integer id) {
try {
@@ -95,7 +95,7 @@ public class AlipayMiniProgramController {
* @return
*/
@PostMapping("/detailTemplate")
- @ApiOperation("/根据账号Id和模板ID获取模板列表")
+ @Operation(summary = "/根据账号Id和模板ID获取模板列表")
@AustinResult
public CommonAmisVo queryDetailList(Integer id, String alipayTemplateId) {
if (Objects.isNull(id) || Objects.isNull(alipayTemplateId)) {
@@ -144,7 +144,7 @@ public class AlipayMiniProgramController {
* @return
*/
@GetMapping("/sync/openid")
- @ApiOperation("登录凭证校验")
+ @Operation(summary = "登录凭证校验")
public String syncOpenId(String code, String appId, String secret) {
String url = SendChanelUrlConstant.WE_CHAT_MINI_PROGRAM_OPENID_SYNC
.replace("", appId).replace("", code).replace("", secret);
diff --git a/austin-web/src/main/java/com/java3y/austin/web/controller/ChannelAccountController.java b/austin-web/src/main/java/com/java3y/austin/web/controller/ChannelAccountController.java
index 6879228..8ff6d9f 100644
--- a/austin-web/src/main/java/com/java3y/austin/web/controller/ChannelAccountController.java
+++ b/austin-web/src/main/java/com/java3y/austin/web/controller/ChannelAccountController.java
@@ -13,8 +13,8 @@ import com.java3y.austin.web.service.ChannelAccountService;
import com.java3y.austin.web.utils.Convert4Amis;
import com.java3y.austin.web.utils.LoginUtils;
import com.java3y.austin.web.vo.amis.CommonAmisVo;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -33,7 +33,7 @@ import java.util.stream.Collectors;
@AustinResult
@RestController
@RequestMapping("/account")
-@Api("渠道账号管理接口")
+@Tag(name = "渠道账号管理接口")
public class ChannelAccountController {
@Autowired
@@ -47,7 +47,7 @@ public class ChannelAccountController {
* 如果Id不存在,则保存
*/
@PostMapping("/save")
- @ApiOperation("/保存数据")
+ @Operation(summary = "/保存数据")
public ChannelAccount saveOrUpdate(@RequestBody ChannelAccount channelAccount) {
if (loginUtils.needLogin() && CharSequenceUtil.isBlank(channelAccount.getCreator())) {
throw new CommonException(RespStatusEnum.NO_LOGIN.getCode(), RespStatusEnum.NO_LOGIN.getMsg());
@@ -61,7 +61,7 @@ public class ChannelAccountController {
* 根据渠道标识查询渠道账号相关的信息
*/
@GetMapping("/queryByChannelType")
- @ApiOperation("/根据渠道标识查询相关的记录")
+ @Operation(summary = "/根据渠道标识查询相关的记录")
public List query(Integer channelType, String creator) {
if (loginUtils.needLogin() && CharSequenceUtil.isBlank(creator)) {
throw new CommonException(RespStatusEnum.NO_LOGIN.getCode(), RespStatusEnum.NO_LOGIN.getMsg());
@@ -76,7 +76,7 @@ public class ChannelAccountController {
* 所有的渠道账号信息
*/
@GetMapping("/list")
- @ApiOperation("/渠道账号列表信息")
+ @Operation(summary = "/渠道账号列表信息")
public List list(String creator) {
if (loginUtils.needLogin() && CharSequenceUtil.isBlank(creator)) {
throw new CommonException(RespStatusEnum.NO_LOGIN.getCode(), RespStatusEnum.NO_LOGIN.getMsg());
@@ -92,7 +92,7 @@ public class ChannelAccountController {
* id多个用逗号分隔开
*/
@DeleteMapping("delete/{id}")
- @ApiOperation("/根据Ids删除")
+ @Operation(summary = "/根据Ids删除")
public void deleteByIds(@PathVariable("id") String id) {
if (CharSequenceUtil.isNotBlank(id)) {
List idList = Arrays.stream(id.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList());
diff --git a/austin-web/src/main/java/com/java3y/austin/web/controller/DataController.java b/austin-web/src/main/java/com/java3y/austin/web/controller/DataController.java
index c1c00fd..d8c1948 100644
--- a/austin-web/src/main/java/com/java3y/austin/web/controller/DataController.java
+++ b/austin-web/src/main/java/com/java3y/austin/web/controller/DataController.java
@@ -8,8 +8,8 @@ import com.java3y.austin.web.vo.DataParam;
import com.java3y.austin.web.vo.amis.EchartsVo;
import com.java3y.austin.web.vo.amis.SmsTimeLineVo;
import com.java3y.austin.web.vo.amis.UserTimeLineVo;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.assertj.core.util.Lists;
import org.springframework.beans.factory.annotation.Autowired;
@@ -31,13 +31,13 @@ import java.util.Objects;
@AustinResult
@RestController
@RequestMapping("/trace")
-@Api("获取数据接口(全链路追踪)")
+@Tag(name = "获取数据接口(全链路追踪)")
public class DataController {
@Autowired
private DataService dataService;
@PostMapping("/message")
- @ApiOperation("/获取【72小时】发送消息的全链路数据")
+ @Operation(summary = "/获取【72小时】发送消息的全链路数据")
public UserTimeLineVo getMessageData(@RequestBody DataParam dataParam) {
if (Objects.isNull(dataParam) || CharSequenceUtil.isBlank(dataParam.getMessageId())) {
return UserTimeLineVo.builder().items(new ArrayList<>()).build();
@@ -46,7 +46,7 @@ public class DataController {
}
@PostMapping("/user")
- @ApiOperation("/获取【当天】用户接收消息的全链路数据")
+ @Operation(summary = "/获取【当天】用户接收消息的全链路数据")
public UserTimeLineVo getUserData(@RequestBody DataParam dataParam) {
if (Objects.isNull(dataParam) || CharSequenceUtil.isBlank(dataParam.getReceiver())) {
return UserTimeLineVo.builder().items(new ArrayList<>()).build();
@@ -55,7 +55,7 @@ public class DataController {
}
@PostMapping("/messageTemplate")
- @ApiOperation("/获取消息模板全链路数据")
+ @Operation(summary = "/获取消息模板全链路数据")
public EchartsVo getMessageTemplateData(@RequestBody DataParam dataParam) {
EchartsVo echartsVo = EchartsVo.builder().build();
if (CharSequenceUtil.isNotBlank(dataParam.getBusinessId())) {
@@ -65,7 +65,7 @@ public class DataController {
}
@PostMapping("/sms")
- @ApiOperation("/获取短信下发数据")
+ @Operation(summary = "/获取短信下发数据")
public SmsTimeLineVo getSmsData(@RequestBody DataParam dataParam) {
if (Objects.isNull(dataParam) || Objects.isNull(dataParam.getDateTime()) || CharSequenceUtil.isBlank(dataParam.getReceiver())) {
return SmsTimeLineVo.builder().items(Lists.newArrayList()).build();
diff --git a/austin-web/src/main/java/com/java3y/austin/web/controller/HealthController.java b/austin-web/src/main/java/com/java3y/austin/web/controller/HealthController.java
index 8f582cc..5fe334d 100644
--- a/austin-web/src/main/java/com/java3y/austin/web/controller/HealthController.java
+++ b/austin-web/src/main/java/com/java3y/austin/web/controller/HealthController.java
@@ -1,8 +1,8 @@
package com.java3y.austin.web.controller;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -14,10 +14,10 @@ import org.springframework.web.bind.annotation.RestController;
*/
@Slf4j
@RestController
-@Api("健康检测")
+@Tag(name = "健康检测")
public class HealthController {
@GetMapping("/")
- @ApiOperation("/健康检测")
+ @Operation(summary = "/健康检测")
public String health() {
return "success";
}
diff --git a/austin-web/src/main/java/com/java3y/austin/web/controller/MaterialController.java b/austin-web/src/main/java/com/java3y/austin/web/controller/MaterialController.java
index c0cf255..5bea917 100644
--- a/austin-web/src/main/java/com/java3y/austin/web/controller/MaterialController.java
+++ b/austin-web/src/main/java/com/java3y/austin/web/controller/MaterialController.java
@@ -5,8 +5,8 @@ import com.java3y.austin.common.enums.ChannelType;
import com.java3y.austin.common.vo.BasicResultVO;
import com.java3y.austin.web.annotation.AustinAspect;
import com.java3y.austin.web.service.MaterialService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@@ -25,7 +25,7 @@ import org.springframework.web.multipart.MultipartFile;
@AustinAspect
@RestController
@RequestMapping("/material")
-@Api("素材管理接口")
+@Tag(name = "素材管理接口")
public class MaterialController {
@Autowired
@@ -42,7 +42,7 @@ public class MaterialController {
* @return
*/
@PostMapping("/upload")
- @ApiOperation("/素材上传接口")
+ @Operation(summary = "/素材上传接口")
public BasicResultVO uploadMaterial(@RequestParam("file") MultipartFile file, String sendAccount, Integer sendChannel, String fileType) {
if (ChannelType.DING_DING_WORK_NOTICE.getCode().equals(sendChannel)) {
return materialService.dingDingMaterialUpload(file, sendAccount, fileType);
diff --git a/austin-web/src/main/java/com/java3y/austin/web/controller/MessageTemplateController.java b/austin-web/src/main/java/com/java3y/austin/web/controller/MessageTemplateController.java
index 3f046ad..a0e70ea 100644
--- a/austin-web/src/main/java/com/java3y/austin/web/controller/MessageTemplateController.java
+++ b/austin-web/src/main/java/com/java3y/austin/web/controller/MessageTemplateController.java
@@ -25,8 +25,8 @@ import com.java3y.austin.web.utils.LoginUtils;
import com.java3y.austin.web.vo.MessageTemplateParam;
import com.java3y.austin.web.vo.MessageTemplateVo;
import com.java3y.austin.web.vo.amis.CommonAmisVo;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -53,7 +53,7 @@ import java.util.stream.Collectors;
@AustinResult
@RestController
@RequestMapping("/messageTemplate")
-@Api("发送消息")
+@Tag(name = "发送消息")
public class MessageTemplateController {
@Autowired
@@ -76,7 +76,7 @@ public class MessageTemplateController {
* 如果Id不存在,则保存
*/
@PostMapping("/save")
- @ApiOperation("/保存数据")
+ @Operation(summary = "/保存数据")
public MessageTemplate saveOrUpdate(@RequestBody MessageTemplate messageTemplate) {
if (loginUtils.needLogin() && CharSequenceUtil.isBlank(messageTemplate.getCreator())) {
throw new CommonException(RespStatusEnum.NO_LOGIN.getCode(), RespStatusEnum.NO_LOGIN.getMsg());
@@ -88,7 +88,7 @@ public class MessageTemplateController {
* 列表数据
*/
@GetMapping("/list")
- @ApiOperation("/列表页")
+ @Operation(summary = "/列表页")
public MessageTemplateVo queryList(@Validated MessageTemplateParam messageTemplateParam) {
if (loginUtils.needLogin() && CharSequenceUtil.isBlank(messageTemplateParam.getCreator())) {
throw new CommonException(RespStatusEnum.NO_LOGIN.getCode(), RespStatusEnum.NO_LOGIN.getMsg());
@@ -102,7 +102,7 @@ public class MessageTemplateController {
* 根据Id查找
*/
@GetMapping("query/{id}")
- @ApiOperation("/根据Id查找")
+ @Operation(summary = "/根据Id查找")
public Map queryById(@PathVariable("id") Long id) {
return Convert4Amis.flatSingleMap(messageTemplateService.queryById(id));
}
@@ -111,7 +111,7 @@ public class MessageTemplateController {
* 根据Id复制
*/
@PostMapping("copy/{id}")
- @ApiOperation("/根据Id复制")
+ @Operation(summary = "/根据Id复制")
public void copyById(@PathVariable("id") Long id) {
messageTemplateService.copy(id);
}
@@ -122,7 +122,7 @@ public class MessageTemplateController {
* id多个用逗号分隔开
*/
@DeleteMapping("delete/{id}")
- @ApiOperation("/根据Ids删除")
+ @Operation(summary = "/根据Ids删除")
public void deleteByIds(@PathVariable("id") String id) {
if (CharSequenceUtil.isNotBlank(id)) {
List idList = Arrays.stream(id.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList());
@@ -135,7 +135,7 @@ public class MessageTemplateController {
* 测试发送接口
*/
@PostMapping("test")
- @ApiOperation("/测试发送接口")
+ @Operation(summary = "/测试发送接口")
public SendResponse test(@RequestBody MessageTemplateParam messageTemplateParam) {
Map variables = JSON.parseObject(messageTemplateParam.getMsgContent(), new TypeReference