-
Notifications
You must be signed in to change notification settings - Fork 701
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
完善抢购微服务接口, 修复若干BUG
- Loading branch information
Showing
22 changed files
with
164 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
common/src/test/java/com/supermarket/common/test/CommonResultTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.supermarket.common.test; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.supermarket.common.vo.CommonResult; | ||
import org.junit.Test; | ||
|
||
public class CommonResultTest { | ||
|
||
@Test | ||
public void testCommonResult() throws JsonProcessingException { | ||
CommonResult<Object> result = CommonResult.failed("怎么回事?"); | ||
ObjectMapper mapper = new ObjectMapper(); | ||
String s = mapper.writeValueAsString(result); | ||
System.out.println(s); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
instant-buy/src/main/java/com/supermarket/instantbuy/config/SwaggerConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.supermarket.instantbuy.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; | ||
import springfox.documentation.builders.PathSelectors; | ||
import springfox.documentation.builders.RequestHandlerSelectors; | ||
import springfox.documentation.service.ApiInfo; | ||
import springfox.documentation.service.Contact; | ||
import springfox.documentation.spi.DocumentationType; | ||
import springfox.documentation.spring.web.plugins.Docket; | ||
|
||
/** | ||
* swagger配置 | ||
* http://192.168.137.147:10008/swagger-ui/ | ||
* 可访问接口文档 | ||
*/ | ||
@Configuration | ||
public class SwaggerConfig { | ||
|
||
@Value("server.port") | ||
private String port = null; | ||
|
||
@Bean | ||
public Docket createRestApi() { | ||
// 创建 Docket 对象 | ||
return new Docket(DocumentationType.SWAGGER_2) // 文档类型,使用 Swagger2 | ||
.apiInfo(this.apiInfo()) // 设置 API 信息 | ||
// 扫描 Controller 包路径,获得 API 接口 | ||
.select() | ||
.apis(RequestHandlerSelectors.basePackage("com.supermarket.instantbuy.controller")) | ||
.paths(PathSelectors.any()) | ||
// 构建出 Docket 对象 | ||
.build(); | ||
} | ||
|
||
/** | ||
* 创建 API 信息 | ||
*/ | ||
private ApiInfo apiInfo() { | ||
return new ApiInfoBuilder() | ||
.title("抢购微服务应用接口文档") | ||
.description("后台文档") | ||
.version("1.1.0.0") // 版本号 | ||
.contact(new Contact("宗祥瑞", "https://github.com/GoogleLLP/SuperMarket", "zxr@tju.edu.cn")) // 联系人 | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...rmarket/instantbuy/schedule/ScanTime.java → ...supermarket/instantbuy/task/ScanTime.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.