mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
1.3.0
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package com.hhdd.book.api.domain;
|
||||
package com.gitee.book.api.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package com.hhdd.book.api.service;
|
||||
package com.gitee.book.api.service;
|
||||
|
||||
import com.gitee.book.api.domain.Book;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
@@ -44,6 +44,29 @@
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger2 -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.9.2</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
<version>1.5.21</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
|
@@ -1,7 +1,9 @@
|
||||
package com.gitee.sop.bookweb.config;
|
||||
|
||||
import com.gitee.sop.servercommon.configuration.AlipayServiceConfiguration;
|
||||
import com.gitee.sop.servercommon.swagger.SwaggerSupport;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
/**
|
||||
* 使用支付宝开放平台功能
|
||||
@@ -9,7 +11,15 @@ import org.springframework.context.annotation.Configuration;
|
||||
*/
|
||||
@Configuration
|
||||
public class OpenServiceConfig extends AlipayServiceConfiguration {
|
||||
|
||||
// 开启文档
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
public static class Swagger2 extends SwaggerSupport {
|
||||
@Override
|
||||
protected String getDocTitle() {
|
||||
return "图书API";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,15 +1,18 @@
|
||||
package com.gitee.sop.bookweb.controller;
|
||||
|
||||
import com.gitee.book.api.domain.Book;
|
||||
import com.gitee.sop.bookweb.consumer.StoryServiceConsumer;
|
||||
import com.gitee.sop.bookweb.param.BookParam;
|
||||
import com.gitee.sop.bookweb.vo.BookVO;
|
||||
import com.gitee.sop.servercommon.annotation.ApiMapping;
|
||||
import com.gitee.sop.story.api.domain.Story;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 支付宝服务端,假设签名验证通过后,到达这里进行具体的业务处理。
|
||||
* 这里演示如何接受业务参数。
|
||||
* @author tanghc
|
||||
*/
|
||||
@@ -19,9 +22,19 @@ public class AlipayBookController {
|
||||
@Autowired
|
||||
StoryServiceConsumer storyServiceConsumer;
|
||||
|
||||
@ApiOperation(value="查询书本信息", notes = "可以根据ISBN查询书本信息")
|
||||
@ApiMapping(value = "book.search")
|
||||
public BookVO searchBook(BookParam param) {
|
||||
BookVO bookVO = new BookVO();
|
||||
bookVO.setId(1);
|
||||
bookVO.setName("白雪公主,ISBN:" + param.getIsbn());
|
||||
bookVO.setIsbn("ABCSSSSDDD");
|
||||
return bookVO;
|
||||
}
|
||||
|
||||
@ApiMapping(value = "alipay.book.get")
|
||||
public Story getBook() {
|
||||
Story story = new Story();
|
||||
public Book getBook() {
|
||||
Book story = new Book();
|
||||
story.setId(1);
|
||||
story.setName("白雪公主(alipay.book.get)");
|
||||
return story;
|
||||
|
@@ -4,7 +4,7 @@ import com.gitee.book.api.domain.Book;
|
||||
import com.gitee.sop.bookweb.consumer.StoryServiceConsumer;
|
||||
import com.gitee.sop.bookweb.param.BookParam;
|
||||
import com.gitee.sop.story.api.domain.Story;
|
||||
import com.hhdd.book.api.service.BookService;
|
||||
import com.gitee.book.api.service.BookService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.gitee.sop.bookweb.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -7,5 +8,9 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class BookParam {
|
||||
@ApiModelProperty(value = "图书id", example = "1")
|
||||
private int id;
|
||||
|
||||
@ApiModelProperty(value = "图书ISBN", example = "xxxx")
|
||||
private String isbn;
|
||||
}
|
||||
|
@@ -0,0 +1,16 @@
|
||||
package com.gitee.sop.bookweb.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BookVO {
|
||||
@ApiModelProperty(value = "图书id", example = "1")
|
||||
private int id;
|
||||
|
||||
@ApiModelProperty(value = "图书名称", example = "白雪公主")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "isbn", example = "xxxxxx")
|
||||
private String isbn;
|
||||
}
|
@@ -17,7 +17,6 @@
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud.version>Greenwich.RELEASE</spring-cloud.version>
|
||||
<swagger.version>2.9.2</swagger.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@@ -44,7 +43,7 @@
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${swagger.version}</version>
|
||||
<version>2.9.2</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.swagger</groupId>
|
||||
@@ -60,7 +59,7 @@
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.version}</version>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
Reference in New Issue
Block a user