Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
service_mall
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冯秋丽
service_mall
Commits
b0ec3965
Commit
b0ec3965
authored
Dec 08, 2020
by
bboymoney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swagger
parent
4c25d0df
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
664 additions
and
192 deletions
+664
-192
compiler.xml
.idea/compiler.xml
+1
-0
pom.xml
pom.xml
+22
-0
BasisMicro.java
src/main/java/com/servicemall/basis/micro/BasisMicro.java
+115
-0
CarAgeMicro.java
src/main/java/com/servicemall/car/micro/CarAgeMicro.java
+10
-7
DemoDto.java
src/main/java/com/servicemall/loyalty/dto/DemoDto.java
+0
-33
DemoOutputDto.java
src/main/java/com/servicemall/loyalty/dto/DemoOutputDto.java
+0
-29
PlanMicro.java
src/main/java/com/servicemall/loyalty/micro/PlanMicro.java
+33
-23
SelectedMicro.java
...ain/java/com/servicemall/loyalty/micro/SelectedMicro.java
+5
-7
SeletedService.java
.../java/com/servicemall/loyalty/service/SeletedService.java
+16
-1
Coupon.java
src/main/java/com/servicemall/right/data/Coupon.java
+50
-39
CouponMicro.java
src/main/java/com/servicemall/right/micro/CouponMicro.java
+31
-25
CouponService.java
...ain/java/com/servicemall/right/service/CouponService.java
+18
-2
ErrorEnum.java
...ain/java/com/servicemall/systemcommon/data/ErrorEnum.java
+20
-19
DateUtil.java
...main/java/com/servicemall/systemcommon/util/DateUtil.java
+302
-0
SliderMicro.java
src/main/java/com/servicemall/website/micro/SliderMicro.java
+5
-2
SliderService.java
...n/java/com/servicemall/website/service/SliderService.java
+12
-1
Swagger2.java
src/main/java/team/bangbang/Swagger2.java
+24
-4
No files found.
.idea/compiler.xml
View file @
b0ec3965
...
...
@@ -2,6 +2,7 @@
<project
version=
"4"
>
<component
name=
"CompilerConfiguration"
>
<annotationProcessing>
<profile
default=
"true"
name=
"Default"
enabled=
"true"
/>
<profile
name=
"Maven default annotation processors profile"
enabled=
"true"
>
<sourceOutputDir
name=
"target/generated-sources/annotations"
/>
<sourceTestOutputDir
name=
"target/generated-test-sources/test-annotations"
/>
...
...
pom.xml
View file @
b0ec3965
...
...
@@ -120,4 +120,26 @@
<!-- </plugins>-->
<!-- </build>-->
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<version>
2.3.1.RELEASE
</version>
<configuration>
<mainClass>
com.ConsoleApplication
</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
src/main/java/com/servicemall/basis/micro/BasisMicro.java
0 → 100644
View file @
b0ec3965
package
com
.
servicemall
.
basis
.
micro
;
import
com.alibaba.fastjson.JSONObject
;
import
com.servicemall.systemcommon.data.Constants
;
import
com.servicemall.systemcommon.data.ErrorEnum
;
import
com.servicemall.systemcommon.data.ValidCheckException
;
import
com.servicemall.systemcommon.util.JsonUtil
;
import
io.swagger.annotations.*
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.*
;
import
team.bangbang.common.data.Pagination
;
import
team.bangbang.common.data.response.DataResponse
;
import
team.bangbang.common.data.response.ResponseBase
;
import
team.bangbang.common.net.http.HttpClient
;
import
team.bangbang.common.net.http.ResponseHandler
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 基础数据 - 微服务
* @author 帮帮组
* @version 1.0 2020-12-08
*/
@Api
(
tags
=
{
"basis"
})
@ApiResponses
(
value
={
@ApiResponse
(
code
=
200
,
message
=
"请求的服务不存在"
)})
@RestController
@CrossOrigin
(
allowCredentials
=
"true"
,
allowedHeaders
=
"*"
,
origins
=
"*"
,
maxAge
=
3600
)
@RequestMapping
(
"/microservice/basis"
)
public
final
class
BasisMicro
{
/**************************************************************************
* !!除非设计、指导人员有特别说明,否则此处不得随意增加、修改、删除!!
* ------------------------------------
*
*************************************************************************/
/**
* 省市接口
*/
@ApiOperation
(
value
=
"获取省市信息"
,
notes
=
"省市信息树形结构"
,
httpMethod
=
"POST"
)
@PostMapping
(
value
=
"/province"
,
produces
=
{
MediaType
.
APPLICATION_JSON_VALUE
},
consumes
=
{
MediaType
.
APPLICATION_JSON_VALUE
})
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"body"
,
name
=
"json"
,
value
=
"入参格式:{}"
,
dataType
=
"string"
)
})
public
ResponseBase
province
(
@RequestBody
String
json
)
{
DataResponse
<
Object
>
result
=
new
DataResponse
<>();
try
{
ResponseHandler
responseHandler
=
new
HttpClient
().
get
(
"http://161.189.8.153:8889/v1/wx/provinces"
);
result
.
setData
(
responseHandler
.
toJSONObject
().
getJSONArray
(
"options"
));
result
.
setMessage
(
"成功"
);
return
result
;
}
catch
(
IOException
e
)
{
return
new
ResponseBase
(
ErrorEnum
.
E_404
.
getCode
(),
ErrorEnum
.
E_404
.
getMessage
());
}
catch
(
ValidCheckException
e
)
{
return
new
ResponseBase
(
e
.
getCode
(),
e
.
getMessage
());
}
}
/**
* 经销商接口
*/
@ApiOperation
(
value
=
"获取经销商信息"
,
notes
=
"经销商信息"
,
httpMethod
=
"POST"
)
@PostMapping
(
value
=
"/dealers"
,
produces
=
{
MediaType
.
APPLICATION_JSON_VALUE
},
consumes
=
{
MediaType
.
APPLICATION_JSON_VALUE
})
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"body"
,
name
=
"json"
,
value
=
"入参格式:{}"
,
dataType
=
"string"
)
})
public
ResponseBase
dealers
(
@RequestBody
String
json
)
{
DataResponse
<
Map
<
String
,
Object
>>
result
=
new
DataResponse
<
Map
<
String
,
Object
>>();
try
{
ResponseHandler
responseHandler
=
new
HttpClient
().
get
(
"http://161.189.8.153:8889/v1/wx/dealers"
);
Map
<
String
,
Object
>
datas
=
new
HashMap
<
String
,
Object
>();
JSONObject
remoteJson
=
responseHandler
.
toJSONObject
();
datas
.
put
(
"list"
,
remoteJson
.
getJSONArray
(
"rows"
));
JSONObject
paginationJson
=
remoteJson
.
getJSONObject
(
"pagination"
);
Pagination
pagination
=
new
Pagination
();
pagination
.
setRecordCount
(
paginationJson
.
getIntValue
(
"total"
));
pagination
.
setMaxResults
(
20
);
//每页条数,接口方默认20
pagination
.
setPageNo
(
paginationJson
.
getIntValue
(
"page"
));
datas
.
put
(
"pagination"
,
pagination
);
result
.
setData
(
datas
);
result
.
setMessage
(
"成功"
);
return
result
;
}
catch
(
IOException
e
)
{
return
new
ResponseBase
(
ErrorEnum
.
E_404
.
getCode
(),
ErrorEnum
.
E_404
.
getMessage
());
}
catch
(
ValidCheckException
e
)
{
return
new
ResponseBase
(
e
.
getCode
(),
e
.
getMessage
());
}
}
/**
* 车型车系接口
*/
@ApiOperation
(
value
=
"获取车型车系信息"
,
notes
=
"车型车系信息"
,
httpMethod
=
"POST"
)
@PostMapping
(
value
=
"/productManagement/getSeriesModels"
,
produces
=
{
MediaType
.
APPLICATION_JSON_VALUE
},
consumes
=
{
MediaType
.
APPLICATION_JSON_VALUE
})
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"body"
,
name
=
"json"
,
value
=
"入参格式:{}"
,
dataType
=
"string"
)
})
public
ResponseBase
getSeriesModels
(
@RequestBody
String
json
)
{
DataResponse
<
Object
>
result
=
new
DataResponse
<>();
try
{
ResponseHandler
responseHandler
=
new
HttpClient
().
get
(
"http://161.189.8.153:8889/v1/product_management/get_series_models"
);
result
.
setData
(
responseHandler
.
toJSONObject
().
get
(
"data"
));
result
.
setMessage
(
"成功"
);
return
result
;
}
catch
(
IOException
e
)
{
return
new
ResponseBase
(
ErrorEnum
.
E_404
.
getCode
(),
ErrorEnum
.
E_404
.
getMessage
());
}
catch
(
ValidCheckException
e
)
{
return
new
ResponseBase
(
e
.
getCode
(),
e
.
getMessage
());
}
}
}
src/main/java/com/servicemall/car/micro/CarAgeMicro.java
View file @
b0ec3965
...
...
@@ -5,10 +5,13 @@ import com.servicemall.systemcommon.data.ValidCheckException;
import
com.servicemall.systemcommon.util.JsonUtil
;
import
com.servicemall.website.data.Slider
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.http.MediaType
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
springfox.documentation.annotations.ApiIgnore
;
import
team.bangbang.common.data.response.DataResponse
;
import
team.bangbang.common.data.response.ResponseBase
;
...
...
@@ -23,7 +26,7 @@ import java.util.Map;
* @author 帮帮组
* @version 1.0 2020-12-08
*/
@Api
(
description
=
"车龄选项获取接口API"
)
@Api
(
tags
=
{
"car"
}
)
@RestController
@CrossOrigin
(
allowCredentials
=
"true"
,
allowedHeaders
=
"*"
,
origins
=
"*"
,
maxAge
=
3600
)
@RequestMapping
(
"/microservice/car/carage"
)
...
...
@@ -35,14 +38,13 @@ public final class CarAgeMicro {
*************************************************************************/
/**
* 查询多条轮播图,并转化为相应的POJO对象列表
*
*
* @return 返回结果记录,并转化为相应的POJO对象列表
* 车龄选项接口
*/
@ApiOperation
(
value
=
"车龄选项"
,
notes
=
"车龄选项列表"
,
httpMethod
=
"POST"
)
@PostMapping
(
value
=
"/list"
,
produces
={
MediaType
.
APPLICATION_JSON_UTF8_VALUE
},
consumes
={
MediaType
.
APPLICATION_JSON_UTF8_VALUE
})
@ResponseBody
@PostMapping
(
value
=
"/list"
,
produces
={
MediaType
.
APPLICATION_JSON_VALUE
},
consumes
={
MediaType
.
APPLICATION_JSON_VALUE
})
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"body"
,
name
=
"json"
,
value
=
"入参格式:{}"
,
dataType
=
"string"
)
})
public
ResponseBase
carAgeList
(
@RequestBody
String
json
)
{
DataResponse
<
Object
>
result
=
new
DataResponse
<>();
try
{
...
...
@@ -51,6 +53,7 @@ public final class CarAgeMicro {
String
[]
carAges
=
Constants
.
carAge
;
datas
.
put
(
"carAge"
,
carAges
);
result
.
setData
(
carAges
);
result
.
setMessage
(
"成功"
);
return
result
;
}
catch
(
ValidCheckException
e
)
{
return
new
ResponseBase
(
e
.
getCode
(),
e
.
getMessage
());
...
...
src/main/java/com/servicemall/loyalty/dto/DemoDto.java
deleted
100644 → 0
View file @
4c25d0df
package
com
.
servicemall
.
loyalty
.
dto
;
import
com.sun.istack.NotNull
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
@Data
@ApiModel
(
value
=
"演示类"
,
description
=
"请求参数类"
)
public
class
DemoDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@NotNull
@ApiModelProperty
(
value
=
"defaultStr"
,
example
=
"mockStrValue"
)
private
String
strDemo
;
@NotNull
@ApiModelProperty
(
example
=
"1234343523"
,
required
=
true
)
private
Long
longNum
;
@NotNull
@ApiModelProperty
(
example
=
"111111.111"
)
private
Double
doubleNum
;
@NotNull
@ApiModelProperty
(
example
=
"2018-12-04T13:46:56.711Z"
)
private
Date
date
;
}
src/main/java/com/servicemall/loyalty/dto/DemoOutputDto.java
deleted
100644 → 0
View file @
4c25d0df
package
com
.
servicemall
.
loyalty
.
dto
;
import
com.sun.istack.NotNull
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.util.Date
;
import
lombok.Data
;
@Data
public
class
DemoOutputDto
{
private
String
res
;
@NotNull
@ApiModelProperty
(
value
=
"defaultOutputStr"
,
example
=
"mockOutputStrValue"
)
private
String
outputStrDemo
;
@NotNull
@ApiModelProperty
(
example
=
"6666666"
,
required
=
true
)
private
Long
outputLongNum
;
@NotNull
@ApiModelProperty
(
example
=
"88888.888"
)
private
Double
outputDoubleNum
;
@NotNull
@ApiModelProperty
(
example
=
"2018-12-12T11:11:11.111Z"
)
private
Date
outputDate
;
}
src/main/java/com/servicemall/loyalty/micro/PlanMicro.java
View file @
b0ec3965
...
...
@@ -8,10 +8,13 @@ import javax.servlet.http.HttpServletRequest;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.web.bind.annotation.*
;
import
springfox.documentation.annotations.ApiIgnore
;
import
team.bangbang.common.data.Pagination
;
import
team.bangbang.common.data.response.ResponseBase
;
import
team.bangbang.common.data.response.DataResponse
;
...
...
@@ -29,7 +32,8 @@ import com.servicemall.loyalty.service.PlanService;
* @author 帮帮组
* @version 1.0 2020-12-08
*/
@Api
(
description
=
"ServiceMall首页API接口"
)
@Api
(
tags
=
{
"loyalty"
})
@ApiResponses
(
value
={
@ApiResponse
(
code
=
200
,
message
=
"请求的服务不存在"
)})
@RestController
@CrossOrigin
(
allowCredentials
=
"true"
,
allowedHeaders
=
"*"
,
origins
=
"*"
,
maxAge
=
3600
)
@RequestMapping
(
"/microservice/loyalty/plan"
)
...
...
@@ -51,6 +55,7 @@ public final class PlanMicro {
* @return 1:成功 其它:失败
*/
@PostMapping
(
"/insert"
)
@ApiIgnore
public
ResponseBase
insert
(
@RequestBody
Plan
plan
,
HttpServletRequest
request
)
{
// 是否存在重复记录?
if
(
exist
(
plan
))
{
...
...
@@ -70,6 +75,7 @@ public final class PlanMicro {
request
.
setAttribute
(
"log"
,
log
);
DataResponse
<
Plan
>
result
=
new
DataResponse
<
Plan
>();
result
.
setMessage
(
"成功"
);
result
.
setData
(
plan
);
return
result
;
...
...
@@ -83,6 +89,7 @@ public final class PlanMicro {
*
* @return 成功删除的记录数量
*/
@ApiIgnore
@PostMapping
(
"/delete"
)
public
ResponseBase
delete
(
@RequestBody
Plan
plan
,
HttpServletRequest
request
)
{
...
...
@@ -123,6 +130,7 @@ public final class PlanMicro {
*
* @return 成功修改的记录数量
*/
@ApiIgnore
@PostMapping
(
"/update"
)
public
ResponseBase
update
(
@RequestBody
Plan
plan
,
HttpServletRequest
request
)
{
// 为防止更新意外,必须传入id才能更新
...
...
@@ -155,7 +163,7 @@ public final class PlanMicro {
plan
=
PlanService
.
getObject
(
plan
,
null
);
DataResponse
<
Plan
>
result
=
new
DataResponse
<
Plan
>();
result
.
setData
(
plan
);
result
.
setMessage
(
"成功"
);
return
result
;
}
...
...
@@ -166,6 +174,7 @@ public final class PlanMicro {
*
* @return 返回结果记录,并转化为相应的POJO对象
*/
@ApiIgnore
@PostMapping
(
"/get"
)
public
ResponseBase
get
(
@RequestBody
Plan
plan
)
{
...
...
@@ -177,7 +186,7 @@ public final class PlanMicro {
plan
=
PlanService
.
getObject
(
plan
,
null
);
DataResponse
<
Plan
>
result
=
new
DataResponse
<
Plan
>();
result
.
setData
(
plan
);
result
.
setMessage
(
"成功"
);
return
result
;
}
...
...
@@ -188,9 +197,9 @@ public final class PlanMicro {
*
* @return 返回结果记录,并转化为相应的POJO对象列表
*/
@ApiOperation
(
value
=
"
post请求调用示例"
,
notes
=
"invokePost说明
"
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"
首页API接口"
,
notes
=
"首页API接口
"
,
httpMethod
=
"POST"
)
@PostMapping
(
"/list"
)
public
ResponseBase
list
(
@RequestBody
Plan
plan
,
@EntityParam
Pagination
pagination
)
{
public
ResponseBase
list
(
@RequestBody
Plan
plan
,
Pagination
pagination
)
{
// 附加限定条件,这里可以修改附加限定条件
String
appendix
=
null
;
...
...
@@ -218,6 +227,7 @@ public final class PlanMicro {
*
* @return 返回记录数量
*/
@ApiIgnore
@PostMapping
(
"/count"
)
public
ResponseBase
count
(
@RequestBody
Plan
plan
)
{
// 附加限定条件,这里可以修改附加限定条件
...
...
@@ -227,7 +237,7 @@ public final class PlanMicro {
DataResponse
<
Integer
>
result
=
new
DataResponse
<
Integer
>();
result
.
setData
(
n
);
result
.
setMessage
(
"成功"
);
return
result
;
}
...
...
src/main/java/com/servicemall/loyalty/micro/SelectedMicro.java
View file @
b0ec3965
...
...
@@ -3,10 +3,7 @@ package com.servicemall.loyalty.micro;
import
com.servicemall.loyalty.data.Selected
;
import
com.servicemall.loyalty.service.SeletedService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.*
;
import
org.springframework.web.bind.annotation.*
;
import
team.bangbang.common.data.Pagination
;
import
team.bangbang.common.data.response.DataResponse
;
...
...
@@ -17,14 +14,15 @@ import java.util.List;
import
java.util.Map
;
/**
* 精选
-
* 精选
*
* 对应
*
* @author 帮帮组
* @version 1.0 2020-12-08
*/
@Api
(
description
=
"ServiceMall首页精选API接口"
)
@Api
(
tags
=
{
"selected"
})
@ApiResponses
(
value
={
@ApiResponse
(
code
=
200
,
message
=
"请求的服务不存在"
)})
@RestController
@CrossOrigin
(
allowCredentials
=
"true"
,
allowedHeaders
=
"*"
,
origins
=
"*"
,
maxAge
=
3600
)
@RequestMapping
(
"/microservice/loyalty/"
)
...
...
@@ -65,7 +63,7 @@ public class SelectedMicro {
datas
.
put
(
"pagination"
,
pagination
);
result
.
setData
(
datas
);
result
.
setMessage
(
"成功"
);
return
result
;
}
}
src/main/java/com/servicemall/loyalty/service/SeletedService.java
View file @
b0ec3965
...
...
@@ -20,9 +20,24 @@ public class SeletedService {
List
<
Selected
>
selectedList
=
new
ArrayList
<>();
Selected
selected
=
new
Selected
();
selected
.
setId
(
1
l
);
selected
.
setType
(
1
);
//1:计划2:活动3:轮胎
selected
.
setImage
(
"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607427778447&di=b0d30539b93ff6e7394b9c80801e11c7&imgtype=0&src=http%3A%2F%2Fimg000.hc360.cn%2Fm6%2FM04%2F58%2F6A%2FwKhQolWVsnmEGYk8AAAAAIA_Z48561.jpg"
);
selected
.
setName
(
"
轮胎
"
);
selected
.
setName
(
"
计划1
"
);
selectedList
.
add
(
selected
);
Selected
selected1
=
new
Selected
();
selected1
.
setId
(
2
l
);
selected1
.
setType
(
2
);
//1:计划2:活动3:轮胎
selected1
.
setImage
(
"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607427778447&di=b0d30539b93ff6e7394b9c80801e11c7&imgtype=0&src=http%3A%2F%2Fimg000.hc360.cn%2Fm6%2FM04%2F58%2F6A%2FwKhQolWVsnmEGYk8AAAAAIA_Z48561.jpg"
);
selected1
.
setName
(
"活动1"
);
selectedList
.
add
(
selected1
);
Selected
selected2
=
new
Selected
();
selected2
.
setId
(
3
l
);
selected2
.
setType
(
3
);
//1:计划2:活动3:轮胎
selected2
.
setImage
(
"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607427778447&di=b0d30539b93ff6e7394b9c80801e11c7&imgtype=0&src=http%3A%2F%2Fimg000.hc360.cn%2Fm6%2FM04%2F58%2F6A%2FwKhQolWVsnmEGYk8AAAAAIA_Z48561.jpg"
);
selected2
.
setName
(
"轮胎1"
);
selectedList
.
add
(
selected2
);
return
selectedList
;
}
}
src/main/java/com/servicemall/right/data/Coupon.java
View file @
b0ec3965
...
...
@@ -72,15 +72,18 @@ public class Coupon {
/* 有效状态{1:有效 2:暂停} */
private
Integer
activeStatus
=
null
;
/* 状态:1未领取 2已领取 */
private
Integer
status
=
null
;
/* 有效期-开始时间 */
private
Date
activeStartTime
=
null
;
private
String
activeStartTime
=
null
;
/* 有效期-开始时间 (查询上线) */
private
Date
activeStartTimeTop
=
null
;
/* 有效期-开始时间 (查询下线) */
private
Date
activeStartTimeBottom
=
null
;
/* 有效期-结束时间 */
private
Date
activeEndTime
=
null
;
private
String
activeEndTime
=
null
;
/* 有效期-结束时间 (查询上线) */
private
Date
activeEndTimeTop
=
null
;
/* 有效期-结束时间 (查询下线) */
...
...
@@ -108,7 +111,7 @@ public class Coupon {
/*
* 固定数据字典 核销类型{1:订单核销 2:快速核销}
*/
public
static
final
String
[]
usedTypeFlags
=
{
"
核销类型{1:订单核销 2:快速核销}
"
};
public
static
final
String
[]
usedTypeFlags
=
{
"
订单核销"
,
"快速核销
"
};
/*
* 固定数据字典 是否可核销多次{1:是 2:否}
...
...
@@ -448,14 +451,14 @@ public class Coupon {
/**
* @return 有效期-开始时间
*/
public
Date
getActiveStartTime
()
{
public
String
getActiveStartTime
()
{
return
activeStartTime
;
}
/**
* @param activeStartTime 有效期-开始时间
*/
public
void
setActiveStartTime
(
Date
activeStartTime
)
{
public
void
setActiveStartTime
(
String
activeStartTime
)
{
this
.
activeStartTime
=
activeStartTime
;
}
...
...
@@ -490,14 +493,14 @@ public class Coupon {
/**
* @return 有效期-结束时间
*/
public
Date
getActiveEndTime
()
{
public
String
getActiveEndTime
()
{
return
activeEndTime
;
}
/**
* @param activeEndTime 有效期-结束时间
*/
public
void
setActiveEndTime
(
Date
activeEndTime
)
{
public
void
setActiveEndTime
(
String
activeEndTime
)
{
this
.
activeEndTime
=
activeEndTime
;
}
...
...
@@ -630,4 +633,12 @@ public class Coupon {
return
getId
().
equals
(((
Coupon
)
obj
).
getId
());
}
public
Integer
getStatus
()
{
return
status
;
}
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
}
src/main/java/com/servicemall/right/micro/CouponMicro.java
View file @
b0ec3965
...
...
@@ -8,9 +8,7 @@ import javax.servlet.http.HttpServletRequest;
import
com.servicemall.loyalty.data.Selected
;
import
com.servicemall.loyalty.service.SeletedService
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.*
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
...
@@ -36,6 +34,8 @@ import com.servicemall.right.service.CouponService;
* @author 帮帮组
* @version 1.0 2020-12-08
*/
@Api
(
tags
=
{
"right"
})
@ApiResponses
(
value
={
@ApiResponse
(
code
=
200
,
message
=
"请求的服务不存在"
)})
@RestController
@CrossOrigin
(
allowCredentials
=
"true"
,
allowedHeaders
=
"*"
,
origins
=
"*"
,
maxAge
=
3600
)
@RequestMapping
(
"/microservice/right/coupon"
)
...
...
@@ -53,6 +53,7 @@ public final class CouponMicro {
*
* @return 1:成功 其它:失败
*/
@ApiIgnore
@PostMapping
(
"/insert"
)
public
ResponseBase
insert
(
@RequestBody
Coupon
coupon
,
HttpServletRequest
request
)
{
// 是否存在重复记录?
...
...
@@ -74,7 +75,7 @@ public final class CouponMicro {
DataResponse
<
Coupon
>
result
=
new
DataResponse
<
Coupon
>();
result
.
setData
(
coupon
);
result
.
setMessage
(
"成功"
);
return
result
;
}
...
...
@@ -86,6 +87,7 @@ public final class CouponMicro {
*
* @return 成功删除的记录数量
*/
@ApiIgnore
@PostMapping
(
"/delete"
)
public
ResponseBase
delete
(
@RequestBody
Coupon
coupon
,
HttpServletRequest
request
)
{
...
...
@@ -126,6 +128,7 @@ public final class CouponMicro {
*
* @return 成功修改的记录数量
*/
@ApiIgnore
@PostMapping
(
"/update"
)
public
ResponseBase
update
(
@RequestBody
Coupon
coupon
,
HttpServletRequest
request
)
{
// 为防止更新意外,必须传入id才能更新
...
...
@@ -158,7 +161,7 @@ public final class CouponMicro {
coupon
=
CouponService
.
getObject
(
coupon
,
null
);
DataResponse
<
Coupon
>
result
=
new
DataResponse
<
Coupon
>();
result
.
setData
(
coupon
);
result
.
setMessage
(
"成功"
);
return
result
;
}
...
...
@@ -169,6 +172,7 @@ public final class CouponMicro {
*
* @return 返回结果记录,并转化为相应的POJO对象
*/
@ApiIgnore
@PostMapping
(
"/get"
)
public
ResponseBase
get
(
@RequestBody
Coupon
coupon
)
{
...
...
@@ -180,7 +184,7 @@ public final class CouponMicro {
coupon
=
CouponService
.
getObject
(
coupon
,
null
);
DataResponse
<
Coupon
>
result
=
new
DataResponse
<
Coupon
>();
result
.
setData
(
coupon
);
result
.
setMessage
(
"成功"
);
return
result
;
}
...
...
@@ -191,6 +195,7 @@ public final class CouponMicro {
*
* @return 返回结果记录,并转化为相应的POJO对象列表
*/
@ApiIgnore
@PostMapping
(
"/list"
)
public
ResponseBase
list
(
@RequestBody
Coupon
coupon
,
@EntityParam
Pagination
pagination
)
{
...
...
@@ -209,7 +214,7 @@ public final class CouponMicro {
datas
.
put
(
"pagination"
,
pagination
);
result
.
setData
(
datas
);
result
.
setMessage
(
"成功"
);
return
result
;
}
...
...
@@ -220,6 +225,7 @@ public final class CouponMicro {
*
* @return 返回记录数量
*/
@ApiIgnore
@PostMapping
(
"/count"
)
public
ResponseBase
count
(
@RequestBody
Coupon
coupon
)
{
// 附加限定条件,这里可以修改附加限定条件
...
...
@@ -229,7 +235,7 @@ public final class CouponMicro {
DataResponse
<
Integer
>
result
=
new
DataResponse
<
Integer
>();
result
.
setData
(
n
);
result
.
setMessage
(
"成功"
);
return
result
;
}
...
...
@@ -331,7 +337,7 @@ public final class CouponMicro {
@PostMapping
(
"/querycouponlist"
)
@ApiOperation
(
value
=
"获取优惠券列表"
,
notes
=
"优惠券列表"
,
httpMethod
=
"POST"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"dms_code"
,
value
=
"经销商code"
,
dataType
=
"
S
tring"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"dms_code"
,
value
=
"经销商code"
,
dataType
=
"
s
tring"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"pageNo"
,
value
=
"分页参数 - 页号,默认为1"
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"pageSize"
,
value
=
"分页参数 - 每页最大记录数量,默认为10"
,
dataType
=
"Integer"
)
})
...
...
@@ -357,7 +363,7 @@ public final class CouponMicro {
datas
.
put
(
"pagination"
,
pagination
);
result
.
setData
(
datas
);
result
.
setMessage
(
"成功"
);
return
result
;
}
}
src/main/java/com/servicemall/right/service/CouponService.java
View file @
b0ec3965
...
...
@@ -4,6 +4,7 @@ import java.util.*;
import
javax.annotation.PostConstruct
;
import
javax.annotation.Resource
;
import
com.servicemall.systemcommon.util.DateUtil
;
import
team.bangbang.common.CommonMPI
;
import
team.bangbang.common.data.KeyValue
;
import
team.bangbang.common.data.Pagination
;
...
...
@@ -223,17 +224,32 @@ public final class CouponService {
public
static
List
<
Coupon
>
queryCouponList
(
String
dms_code
,
Pagination
pagination
){
List
<
Coupon
>
couponList
=
new
ArrayList
<>();
Coupon
coupon
=
new
Coupon
();
coupon
.
setActiveEndTime
(
new
Dat
e
());
coupon
.
setActiveStartTime
(
new
Dat
e
());
coupon
.
setActiveEndTime
(
DateUtil
.
getTim
e
());
coupon
.
setActiveStartTime
(
DateUtil
.
getTim
e
());
coupon
.
setRightName
(
"代金券"
);
coupon
.
setUsedTypeFlag
(
1
);
coupon
.
setTotalUseNum
(-
1
);
coupon
.
setId
(
1
l
);
coupon
.
setSortValue
(
1
);
coupon
.
setStatus
(
1
);
Map
<
String
,
Integer
>
map
=
new
HashMap
<
String
,
Integer
>();
map
.
put
(
"price"
,
10
);
coupon
.
setRightContent
(
map
.
toString
());
couponList
.
add
(
coupon
);
Coupon
coupon1
=
new
Coupon
();
coupon1
.
setActiveEndTime
(
DateUtil
.
getTime
());
coupon1
.
setActiveStartTime
(
DateUtil
.
getTime
());
coupon1
.
setRightName
(
"折扣券"
);
coupon1
.
setUsedTypeFlag
(
2
);
coupon1
.
setTotalUseNum
(-
1
);
coupon1
.
setId
(
2
l
);
coupon1
.
setSortValue
(
1
);
coupon1
.
setStatus
(
2
);
Map
<
String
,
Integer
>
map1
=
new
HashMap
<
String
,
Integer
>();
map1
.
put
(
"price"
,
10
);
coupon1
.
setRightContent
(
map1
.
toString
());
couponList
.
add
(
coupon1
);
return
couponList
;
}
}
src/main/java/com/servicemall/systemcommon/data/ErrorEnum.java
View file @
b0ec3965
...
...
@@ -18,25 +18,26 @@ public enum ErrorEnum {
E_202
(
202
,
"请求参数缺少必要字段"
),
E_203
(
203
,
"json格式有误"
),
E_301
(
300
,
"当前操作无权限"
),
E_302
(
301
,
"Token过期"
),
E_303
(
302
,
"签名sign无效"
),
E_304
(
303
,
"请求IP不被允许"
),
E_401
(
400
,
"网络错误"
),
E_402
(
401
,
"业务逻辑错误"
),
E_403
(
402
,
"数据库错误"
),
E_404
(
403
,
"文件操作错误"
),
E_501
(
500
,
"记录未发现"
),
E_502
(
501
,
"数据库中存在重复的记录"
),
E_503
(
502
,
"无数据"
),
E_504
(
503
,
"系统保护数据,不可修改或删除"
),
E_1001
(
1000
,
"账号或者密码错误"
),
E_1002
(
1001
,
"账号已经被禁用"
),
E_1003
(
1002
,
"没有登录或者长时间未操作导致登录信息丢失"
);
E_300
(
300
,
"当前操作无权限"
),
E_301
(
301
,
"Token过期"
),
E_302
(
302
,
"签名sign无效"
),
E_303
(
303
,
"请求IP不被允许"
),
E_400
(
400
,
"网络错误"
),
E_401
(
401
,
"业务逻辑错误"
),
E_402
(
402
,
"数据库错误"
),
E_403
(
403
,
"文件操作错误"
),
E_404
(
404
,
"调用第三方接口异常"
),
E_500
(
500
,
"记录未发现"
),
E_501
(
501
,
"数据库中存在重复的记录"
),
E_502
(
502
,
"无数据"
),
E_503
(
503
,
"系统保护数据,不可修改或删除"
),
E_1000
(
1000
,
"账号或者密码错误"
),
E_1001
(
1001
,
"账号已经被禁用"
),
E_1002
(
1002
,
"没有登录或者长时间未操作导致登录信息丢失"
);
// 成员变量
...
...
src/main/java/com/servicemall/systemcommon/util/DateUtil.java
0 → 100644
View file @
b0ec3965
package
com
.
servicemall
.
systemcommon
.
util
;
import
org.springframework.util.StringUtils
;
import
java.text.DateFormat
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
/**
* 说明:日期处理 创建人:warren 修改时间:2015年11月24日
*
* @version
*/
public
class
DateUtil
{
private
final
static
SimpleDateFormat
sdfYear
=
new
SimpleDateFormat
(
"yyyy"
);
private
final
static
SimpleDateFormat
sdfMonth
=
new
SimpleDateFormat
(
"MM"
);
private
final
static
SimpleDateFormat
sdfDate
=
new
SimpleDateFormat
(
"dd"
);
private
final
static
SimpleDateFormat
sdfDay
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
private
final
static
SimpleDateFormat
sdfDays
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
private
final
static
SimpleDateFormat
sdfTime
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
private
final
static
SimpleDateFormat
sdfTimes
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
/**
* 获取YYYY格式
*
* @return
*/
public
static
String
getSdfTimes
()
{
return
sdfTimes
.
format
(
new
Date
());
}
/**
* 获取YYYY格式
*
* @return
*/
public
static
String
getYear
()
{
return
sdfYear
.
format
(
new
Date
());
}
/**
* 获取MM格式
*
* @return
*/
public
static
String
getMonth
()
{
return
sdfMonth
.
format
(
new
Date
());
}
/**
* 获取YYYY-MM-DD格式
*
* @return
*/
public
static
String
getDay
()
{
return
sdfDay
.
format
(
new
Date
());
}
/**
* 获取YYYYMMDD格式
*
* @return
*/
public
static
String
getDays
()
{
return
sdfDays
.
format
(
new
Date
());
}
/**
* 获取DD格式
*
* @return
*/
public
static
String
getDate
()
{
return
sdfDate
.
format
(
new
Date
());
}
/**
* 获取YYYY-MM-DD HH:mm:ss格式
*
* @return
*/
public
static
String
getTime
()
{
return
sdfTime
.
format
(
new
Date
());
}
/**
* @Title: compareDate
* @Description: TODO(日期比较,如果s>=e 返回true 否则返回false)
* @param s
* @param e
* @return boolean
* @throws @author
* fh
*/
public
static
boolean
compareDate
(
String
s
,
String
e
)
{
if
(
fomatDate
(
s
)
==
null
||
fomatDate
(
e
)
==
null
)
{
return
false
;
}
return
fomatDate
(
s
).
getTime
()
>=
fomatDate
(
e
).
getTime
();
}
/**
* 格式化日期
*
* @return
*/
public
static
Date
fomatDate
(
String
date
)
{
DateFormat
fmt
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
try
{
return
fmt
.
parse
(
date
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
/**
* 校验日期是否合法
*
* @return
*/
public
static
boolean
isValidDate
(
String
s
)
{
DateFormat
fmt
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
try
{
fmt
.
parse
(
s
);
return
true
;
}
catch
(
Exception
e
)
{
// 如果throw java.text.ParseException或者NullPointerException,就说明格式不对
return
false
;
}
}
/**
* @param startTime
* @param endTime
* @return
*/
public
static
int
getDiffYear
(
String
startTime
,
String
endTime
)
{
DateFormat
fmt
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
try
{
// long aa=0;
int
years
=
(
int
)
(((
fmt
.
parse
(
endTime
).
getTime
()
-
fmt
.
parse
(
startTime
).
getTime
())
/
(
1000
*
60
*
60
*
24
))
/
365
);
return
years
;
}
catch
(
Exception
e
)
{
// 如果throw java.text.ParseException或者NullPointerException,就说明格式不对
return
0
;
}
}
/**
* <li>功能描述:时间相减得到天数
*
* @param beginDateStr
* @param endDateStr
* @return long
* @author Administrator
*/
public
static
long
getDaySub
(
String
beginDateStr
,
String
endDateStr
)
{
long
day
=
0
;
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
beginDate
=
null
;
Date
endDate
=
null
;
try
{
beginDate
=
format
.
parse
(
beginDateStr
);
endDate
=
format
.
parse
(
endDateStr
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
day
=
(
endDate
.
getTime
()
-
beginDate
.
getTime
())
/
(
24
*
60
*
60
*
1000
);
// System.out.println("相隔的天数="+day);
return
day
;
}
/**
* 得到n天之后的日期
*
* @param days
* @return
*/
public
static
String
getAfterDayDate
(
String
days
)
{
int
daysInt
=
Integer
.
parseInt
(
days
);
Calendar
canlendar
=
Calendar
.
getInstance
();
// java.util包
canlendar
.
add
(
Calendar
.
DATE
,
daysInt
);
// 日期减 如果不够减会将月变动
Date
date
=
canlendar
.
getTime
();
SimpleDateFormat
sdfd
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
String
dateStr
=
sdfd
.
format
(
date
);
return
dateStr
;
}
/**
* 得到n天之后是周几
*
* @param days
* @return
*/
public
static
String
getAfterDayWeek
(
String
days
)
{
int
daysInt
=
Integer
.
parseInt
(
days
);
Calendar
canlendar
=
Calendar
.
getInstance
();
// java.util包
canlendar
.
add
(
Calendar
.
DATE
,
daysInt
);
// 日期减 如果不够减会将月变动
Date
date
=
canlendar
.
getTime
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"E"
);
String
dateStr
=
sdf
.
format
(
date
);
return
dateStr
;
}
public
static
Long
dateToStamp
(
String
s
)
throws
ParseException
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"HH:mm"
);
Date
date
=
simpleDateFormat
.
parse
(
s
);
long
ts
=
date
.
getTime
();
return
ts
;
}
public
static
String
getHMS
(
long
timetemp
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTimeInMillis
(
timetemp
);
SimpleDateFormat
fmat
=
new
SimpleDateFormat
(
"HH:mm"
);
String
time
=
fmat
.
format
(
calendar
.
getTime
());
return
time
;
}
public
static
String
getYMDHMS
(
long
timetemp
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTimeInMillis
(
timetemp
);
SimpleDateFormat
fmat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
String
time
=
fmat
.
format
(
calendar
.
getTime
());
return
time
;
}
public
static
void
main
(
String
[]
args
)
{
}
/**
* 获取开始日期到今天的间隔天数
*
* @param startDate
* 开始时间
* @return 相差天数
*/
public
static
long
daysBetween
(
Date
startDate
)
{
return
daysBetween
(
startDate
,
new
Date
());
}
/**
* 获取两个日期之间间隔的天数
*
* @param startDate
* 开始时间
* @param endDate
* 结束时间
* @return 相差天数
*/
public
static
long
daysBetween
(
Date
startDate
,
Date
endDate
)
{
return
(
endDate
.
getTime
()
-
startDate
.
getTime
())
/
(
1000
*
3600
*
24
)
+
1
;
}
/**
* 字符串转日期
* @param datestr
* @return
*/
public
static
Date
getDateFromStr
(
String
datestr
)
{
SimpleDateFormat
fmt
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
try
{
return
fmt
.
parse
(
datestr
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
/**
* 字符串转日期
* @param date
* @param fmt 形如yyyy-MM-dd HH:mm:ss
* @return
*/
public
static
String
getStrFromDate
(
Date
date
,
String
fmt
)
{
if
(
StringUtils
.
isEmpty
(
fmt
)){
return
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
date
);
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
fmt
);
return
sdf
.
format
(
date
);
}
}
src/main/java/com/servicemall/website/micro/SliderMicro.java
View file @
b0ec3965
...
...
@@ -9,6 +9,8 @@ import javax.servlet.http.HttpServletRequest;
import
com.servicemall.website.service.SliderService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
org.springframework.web.bind.annotation.*
;
import
springfox.documentation.annotations.ApiIgnore
;
...
...
@@ -28,7 +30,8 @@ import com.servicemall.website.data.Slider;
* @author 帮帮组
* @version 1.0 2020-12-08
*/
@Api
(
description
=
"ServiceMall首页轮播图接口"
)
@Api
(
tags
=
{
"slide"
})
@ApiResponses
(
value
={
@ApiResponse
(
code
=
200
,
message
=
"请求的服务不存在"
)})
@RestController
@CrossOrigin
(
allowCredentials
=
"true"
,
allowedHeaders
=
"*"
,
origins
=
"*"
,
maxAge
=
3600
)
@RequestMapping
(
"/microservice/website/slider"
)
...
...
src/main/java/com/servicemall/website/service/SliderService.java
View file @
b0ec3965
...
...
@@ -21,9 +21,20 @@ public class SliderService {
Slider
slider
=
new
Slider
();
slider
.
setId
(
1
l
);
slider
.
setImageUrl
(
"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607427778447&di=b0d30539b93ff6e7394b9c80801e11c7&imgtype=0&src=http%3A%2F%2Fimg000.hc360.cn%2Fm6%2FM04%2F58%2F6A%2FwKhQolWVsnmEGYk8AAAAAIA_Z48561.jpg"
);
slider
.
setJumpUrl
(
"
轮胎
"
);
slider
.
setJumpUrl
(
"
https://www.baidu.com
"
);
slider
.
setSortNo
(
1
);
slider
.
setDblclickImage
(
"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607427778447&di=b0d30539b93ff6e7394b9c80801e11c7&imgtype=0&src=http%3A%2F%2Fimg000.hc360.cn%2Fm6%2FM04%2F58%2F6A%2FwKhQolWVsnmEGYk8AAAAAIA_Z48561.jpg"
);
slider
.
setSliderName
(
"轮播1名称"
);
sliderList
.
add
(
slider
);
Slider
slider1
=
new
Slider
();
slider1
.
setId
(
1
l
);
slider1
.
setImageUrl
(
"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607427778447&di=b0d30539b93ff6e7394b9c80801e11c7&imgtype=0&src=http%3A%2F%2Fimg000.hc360.cn%2Fm6%2FM04%2F58%2F6A%2FwKhQolWVsnmEGYk8AAAAAIA_Z48561.jpg"
);
slider1
.
setJumpUrl
(
"https://www.baidu.com"
);
slider1
.
setSortNo
(
2
);
slider1
.
setDblclickImage
(
"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607427778447&di=b0d30539b93ff6e7394b9c80801e11c7&imgtype=0&src=http%3A%2F%2Fimg000.hc360.cn%2Fm6%2FM04%2F58%2F6A%2FwKhQolWVsnmEGYk8AAAAAIA_Z48561.jpg"
);
slider1
.
setSliderName
(
"轮播2名称"
);
sliderList
.
add
(
slider1
);
return
sliderList
;
}
}
src/main/java/team/bangbang/Swagger2.java
View file @
b0ec3965
...
...
@@ -7,7 +7,9 @@ import org.springframework.context.annotation.Configuration;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
springfox.documentation.builders.ResponseMessageBuilder
;
import
springfox.documentation.schema.ModelRef
;
import
springfox.documentation.service.Contact
;
import
springfox.documentation.service.ResponseMessage
;
import
springfox.documentation.service.Tag
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
import
team.bangbang.common.config.Config
;
import
springfox.documentation.builders.ApiInfoBuilder
;
...
...
@@ -62,19 +64,37 @@ public class Swagger2 {
.
globalResponseMessage
(
RequestMethod
.
PUT
,
responseMessageList
)
.
globalResponseMessage
(
RequestMethod
.
DELETE
,
responseMessageList
)
.
apiInfo
(
apiInfo
()).
select
()
.
apiInfo
(
apiInfo
())
.
tags
(
new
Tag
(
"loyalty"
,
"礼遇计划相关"
),
getTags
())
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.servicemall"
)).
paths
(
PathSelectors
.
any
())
.
build
();
}
private
Tag
[]
getTags
()
{
Tag
[]
tags
=
{
new
Tag
(
"basis"
,
"基础数据相关"
),
new
Tag
(
"car"
,
"车辆相关"
),
new
Tag
(
"selected"
,
"精选相关"
),
new
Tag
(
"right"
,
"权益相关"
),
new
Tag
(
"slide"
,
"轮播相关"
)
};
return
tags
;
}
/**
* 创建该API的基本信息(这些基本信息会展现在文档页面中) 访问地址:http://项目实际地址/swagger-ui.html
*
* @return
*/
private
ApiInfo
apiInfo
()
{
return
new
ApiInfoBuilder
().
title
(
Config
.
getProperty
(
"spring.application.name"
))
.
description
(
"更多请关注http://console.bangbang.team/"
).
termsOfServiceUrl
(
"http://console.bangbang.team/"
)
.
version
(
"1.0"
).
build
();
return
new
ApiInfoBuilder
()
.
title
(
"ServiceMall 后端接口 APIs"
)
.
description
(
"api根地址:http://49.234.59.211/"
)
//.termsOfServiceUrl("http://49.234.59.211/")
//.contact(new Contact("钱旺", "", ""))
.
version
(
"1.0"
)
.
build
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment