diff --git a/austin-handler/src/main/java/com/java3y/austin/receiver/Receiver.java b/austin-handler/src/main/java/com/java3y/austin/receiver/Receiver.java index 8648b75..a89749a 100644 --- a/austin-handler/src/main/java/com/java3y/austin/receiver/Receiver.java +++ b/austin-handler/src/main/java/com/java3y/austin/receiver/Receiver.java @@ -1,6 +1,5 @@ package com.java3y.austin.receiver; -import cn.monitor4all.logRecord.annotation.OperationLog; import com.alibaba.fastjson.JSON; import com.java3y.austin.domain.AnchorInfo; import com.java3y.austin.domain.LogParam; diff --git a/austin-service-api/src/main/java/com/java3y/austin/domain/MessageParam.java b/austin-service-api/src/main/java/com/java3y/austin/domain/MessageParam.java index 04ae899..b304f51 100644 --- a/austin-service-api/src/main/java/com/java3y/austin/domain/MessageParam.java +++ b/austin-service-api/src/main/java/com/java3y/austin/domain/MessageParam.java @@ -22,7 +22,7 @@ public class MessageParam { private String receiver; /** - * @Description: 消息内容中的可变部分 + * @Description: 消息内容中的可变部分(占位符替换) * 可选 */ private Map variables; diff --git a/austin-service-api/src/main/java/com/java3y/austin/domain/SendRequest.java b/austin-service-api/src/main/java/com/java3y/austin/domain/SendRequest.java index ff55c6f..a09a33d 100644 --- a/austin-service-api/src/main/java/com/java3y/austin/domain/SendRequest.java +++ b/austin-service-api/src/main/java/com/java3y/austin/domain/SendRequest.java @@ -17,7 +17,7 @@ import lombok.experimental.Accessors; public class SendRequest { /** - * 执行业务类型 + * 执行业务类型(默认填写 "send") */ private String code; diff --git a/austin-support/pom.xml b/austin-support/pom.xml index 2bdc228..fcdc72f 100644 --- a/austin-support/pom.xml +++ b/austin-support/pom.xml @@ -73,6 +73,11 @@ cn.monitor4all log-record-starter + + + de.siegmar + logback-gelf + \ No newline at end of file diff --git a/austin-web/pom.xml b/austin-web/pom.xml index 91b59a3..f1af1f5 100644 --- a/austin-web/pom.xml +++ b/austin-web/pom.xml @@ -44,15 +44,9 @@ io.springfox - springfox-swagger2 + springfox-boot-starter - - io.springfox - springfox-swagger-ui - - - diff --git a/austin-web/src/main/java/com/java3y/austin/config/SwaggerConfig.java b/austin-web/src/main/java/com/java3y/austin/config/SwaggerConfig.java deleted file mode 100644 index d96f99c..0000000 --- a/austin-web/src/main/java/com/java3y/austin/config/SwaggerConfig.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.java3y.austin.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import springfox.documentation.builders.ApiInfoBuilder; -import springfox.documentation.builders.PathSelectors; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.service.ApiInfo; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; - -/** - * @program: austin - * @description: swagger - * @author: YorickGu - * @create: 2022-01-09 17:22 - **/ - -@Configuration -@EnableSwagger2 -public class SwaggerConfig { - @Bean - public Docket createRestApi() { - return new Docket(DocumentationType.SWAGGER_2) - // 指定构建api文档的详细信息的方法:apiInfo() - .apiInfo(apiInfo()) - .select() - // 指定要生成api接口的包路径 - .apis(RequestHandlerSelectors.basePackage("com.java3y.austin.controller")) - //使用了 @ApiOperation 注解的方法生成api接口文档 - //.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) - .paths(PathSelectors.any()) - //可以根据url路径设置哪些请求加入文档,忽略哪些请求 - .build(); - } - - /** - * 设置api文档的详细信息 - */ - private ApiInfo apiInfo() { - return new ApiInfoBuilder() - // 标题 - .title("Austin") - // 接口描述 - .description("Austin") - // 版本信息 - .version("1.0") - // 构建 - .build(); - } -} diff --git a/austin-web/src/main/java/com/java3y/austin/config/SwaggerConfiguration.java b/austin-web/src/main/java/com/java3y/austin/config/SwaggerConfiguration.java new file mode 100644 index 0000000..4e00af6 --- /dev/null +++ b/austin-web/src/main/java/com/java3y/austin/config/SwaggerConfiguration.java @@ -0,0 +1,48 @@ +package com.java3y.austin.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; + + +@Component +@EnableOpenApi +@ApiModel +public class SwaggerConfiguration { + /** + * 对C端用户的接口文档 + * + * @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.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/controller/SendController.java b/austin-web/src/main/java/com/java3y/austin/controller/SendController.java index ca8c5bb..7d6c7c0 100644 --- a/austin-web/src/main/java/com/java3y/austin/controller/SendController.java +++ b/austin-web/src/main/java/com/java3y/austin/controller/SendController.java @@ -23,13 +23,12 @@ public class SendController { /** * 发送消息接口 - * 示例:curl -XPOST "127.0.0.1:8080/send" -H 'Content-Type: application/json' -d '{"code":"send","messageParam":{"receiver":"13788888888","variables":{"title":"yyyyyy","contentValue":"6666164180"}},"messageTemplateId":1}' + * 入参完整示例:curl -XPOST "127.0.0.1:8080/send" -H 'Content-Type: application/json' -d '{"code":"send","messageParam":{"receiver":"13788888888","variables":{"title":"yyyyyy","contentValue":"6666164180"}},"messageTemplateId":1}' * @return */ - @ApiOperation(value = "下发接口",notes = "多渠道多类型下发消息,目前支持邮件和短信,类型支持:验证码、通知类、营销类") + @ApiOperation(value = "下发接口",notes = "多渠道多类型下发消息,目前支持邮件和短信,类型支持:验证码、通知类、营销类。") @PostMapping("/send") - public SendResponse send(@ApiParam(value = "下发消息参数",required = true, examples = @Example(@ExampleProperty(mediaType = "application/json", value = "{\"code\":\"send\",\"messageParam\":{\"receiver\":\"13788888888\",\"variables\":{\"title\":\"yyyyyy\",\"contentValue\":\"6666164180\"}},\"messageTemplateId\":1}")),example = "{\"code\":\"send\",\"messageParam\":{\"receiver\":\"13788888888\",\"variables\":{\"title\":\"yyyyyy\",\"contentValue\":\"6666164180\"}},\"messageTemplateId\":1}") - @RequestBody SendRequest sendRequest) { + public SendResponse send(@RequestBody SendRequest sendRequest) { return sendService.send(sendRequest); } } diff --git a/austin-web/src/main/resources/logback.xml b/austin-web/src/main/resources/logback.xml index 5fff09b..9628bce 100644 --- a/austin-web/src/main/resources/logback.xml +++ b/austin-web/src/main/resources/logback.xml @@ -71,11 +71,42 @@ + + + 120.48.13.113 + + 12201 + + 508 + + true + + + false + true + true + false + false + + true + + %m%nopex + + + %d - [%thread] %-5level %logger{35} - %msg%n + + + + app_name:austin + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 1fffdfc..0b3eb6b 100644 --- a/pom.xml +++ b/pom.xml @@ -96,15 +96,19 @@ 1.6.2 + io.springfox - springfox-swagger2 - 2.9.2 + springfox-boot-starter + 3.0.0 + + + - io.springfox - springfox-swagger-ui - 2.9.2 + de.siegmar + logback-gelf + 3.0.0