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
500cc3aa
Commit
500cc3aa
authored
Dec 09, 2020
by
bboymoney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swagger样式调整
parent
7e279be3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
281 additions
and
37 deletions
+281
-37
ConsoleApplication.java
src/main/java/com/ConsoleApplication.java
+1
-0
BasisMicro.java
src/main/java/com/servicemall/basis/micro/BasisMicro.java
+20
-25
CarAgeMicro.java
src/main/java/com/servicemall/car/micro/CarAgeMicro.java
+4
-8
PlanMicro.java
src/main/java/com/servicemall/loyalty/micro/PlanMicro.java
+2
-1
ErrorEnum.java
...ain/java/com/servicemall/systemcommon/data/ErrorEnum.java
+3
-3
StatusCode.java
src/main/java/team/bangbang/common/data/StatusCode.java
+121
-0
ResponseBase.java
...java/team/bangbang/common/data/response/ResponseBase.java
+130
-0
No files found.
src/main/java/com/ConsoleApplication.java
View file @
500cc3aa
...
...
@@ -6,6 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import
org.springframework.boot.web.servlet.ServletComponentScan
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
/**
* 管理后台
...
...
src/main/java/com/servicemall/basis/micro/BasisMicro.java
View file @
500cc3aa
...
...
@@ -6,6 +6,7 @@ import com.servicemall.systemcommon.data.ErrorEnum;
import
com.servicemall.systemcommon.data.ValidCheckException
;
import
com.servicemall.systemcommon.util.JsonUtil
;
import
io.swagger.annotations.*
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.*
;
import
team.bangbang.common.data.Pagination
;
...
...
@@ -24,10 +25,9 @@ import java.util.Map;
* @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
"
)
@RequestMapping
(
value
=
"/microservice/basis"
,
produces
=
"application/json;charset=UTF-8
"
)
public
final
class
BasisMicro
{
/**************************************************************************
* !!除非设计、指导人员有特别说明,否则此处不得随意增加、修改、删除!!
...
...
@@ -38,20 +38,17 @@ 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
)
{
@ApiOperation
(
value
=
"获取省市信息"
,
notes
=
"省市信息树形结构"
,
httpMethod
=
"GET"
)
@GetMapping
(
value
=
"/province"
)
public
ResponseBase
province
()
{
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_40
4
.
getCode
(),
ErrorEnum
.
E_404
.
getMessage
());
return
new
ResponseBase
(
ErrorEnum
.
E_40
5
.
getCode
(),
ErrorEnum
.
E_405
.
getMessage
());
}
catch
(
ValidCheckException
e
)
{
return
new
ResponseBase
(
e
.
getCode
(),
e
.
getMessage
());
}
...
...
@@ -60,13 +57,14 @@ public final class BasisMicro {
/**
* 经销商接口
*/
@ApiOperation
(
value
=
"获取经销商信息"
,
notes
=
"经销商信息"
,
httpMethod
=
"
POS
T"
)
@
PostMapping
(
value
=
"/dealers"
,
produces
=
{
MediaType
.
APPLICATION_JSON_VALUE
},
consumes
=
{
MediaType
.
APPLICATION_JSON_VALUE
}
)
@ApiOperation
(
value
=
"获取经销商信息"
,
notes
=
"经销商信息"
,
httpMethod
=
"
GE
T"
)
@
GetMapping
(
value
=
"/dealers"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"body"
,
name
=
"json"
,
value
=
"入参格式:{}"
,
dataType
=
"string"
)
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"pageNo"
,
value
=
"分页参数 - 页号,默认为1"
,
dataType
=
"int"
,
defaultValue
=
"1"
,
required
=
false
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"pageSize"
,
value
=
"分页参数 - 每页最大记录数量,默认为10"
,
dataType
=
"int"
,
defaultValue
=
"10"
,
required
=
false
)
})
public
ResponseBase
dealers
(
@Request
Body
String
json
)
{
DataResponse
<
Map
<
String
,
Object
>>
result
=
new
DataResponse
<
Map
<
String
,
Object
>
>();
public
ResponseBase
dealers
(
@Request
Param
(
defaultValue
=
"1"
,
required
=
false
)
Integer
pageNo
,
@RequestParam
(
defaultValue
=
"10"
,
required
=
false
)
Integer
pageSize
)
{
DataResponse
<
Map
<
String
,
Object
>>
result
=
new
DataResponse
<>();
try
{
ResponseHandler
responseHandler
=
new
HttpClient
().
get
(
"http://161.189.8.153:8889/v1/wx/dealers"
);
...
...
@@ -81,10 +79,10 @@ public final class BasisMicro {
datas
.
put
(
"pagination"
,
pagination
);
result
.
setData
(
datas
);
result
.
setMessage
(
"成功"
);
return
result
;
}
catch
(
IOException
e
)
{
return
new
ResponseBase
(
ErrorEnum
.
E_40
4
.
getCode
(),
ErrorEnum
.
E_404
.
getMessage
());
return
new
ResponseBase
(
ErrorEnum
.
E_40
5
.
getCode
(),
ErrorEnum
.
E_405
.
getMessage
());
}
catch
(
ValidCheckException
e
)
{
return
new
ResponseBase
(
e
.
getCode
(),
e
.
getMessage
());
}
...
...
@@ -93,20 +91,17 @@ public final class BasisMicro {
/**
* 车型车系接口
*/
@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
)
{
@ApiOperation
(
value
=
"获取车型车系信息"
,
notes
=
"车型车系信息"
,
httpMethod
=
"GET"
)
@GetMapping
(
value
=
"/productManagement/getSeriesModels"
)
public
ResponseBase
getSeriesModels
()
{
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_40
4
.
getCode
(),
ErrorEnum
.
E_404
.
getMessage
());
return
new
ResponseBase
(
ErrorEnum
.
E_40
5
.
getCode
(),
ErrorEnum
.
E_405
.
getMessage
());
}
catch
(
ValidCheckException
e
)
{
return
new
ResponseBase
(
e
.
getCode
(),
e
.
getMessage
());
}
...
...
src/main/java/com/servicemall/car/micro/CarAgeMicro.java
View file @
500cc3aa
...
...
@@ -29,7 +29,7 @@ import java.util.Map;
@Api
(
tags
=
{
"car"
})
@RestController
@CrossOrigin
(
allowCredentials
=
"true"
,
allowedHeaders
=
"*"
,
origins
=
"*"
,
maxAge
=
3600
)
@RequestMapping
(
"/microservice/car/carage
"
)
@RequestMapping
(
value
=
"/microservice/car/carage"
,
produces
=
"application/json;charset=UTF-8
"
)
public
final
class
CarAgeMicro
{
/**************************************************************************
* !!除非设计、指导人员有特别说明,否则此处不得随意增加、修改、删除!!
...
...
@@ -40,15 +40,11 @@ public final class CarAgeMicro {
/**
* 车龄选项接口
*/
@ApiOperation
(
value
=
"车龄选项"
,
notes
=
"车龄选项列表"
,
httpMethod
=
"POST"
)
@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
)
{
@ApiOperation
(
value
=
"车龄选项"
,
notes
=
"车龄选项列表"
,
httpMethod
=
"GET"
)
@GetMapping
(
"/list"
)
public
ResponseBase
carAgeList
()
{
DataResponse
<
Object
>
result
=
new
DataResponse
<>();
try
{
Map
<
String
,
Object
>
paramMap
=
JsonUtil
.
toBean
(
json
,
Map
.
class
);
Map
<
String
,
Object
>
datas
=
new
HashMap
<>();
String
[]
carAges
=
Constants
.
carAge
;
datas
.
put
(
"carAge"
,
carAges
);
...
...
src/main/java/com/servicemall/loyalty/micro/PlanMicro.java
View file @
500cc3aa
...
...
@@ -197,7 +197,8 @@ public final class PlanMicro {
*
* @return 返回结果记录,并转化为相应的POJO对象列表
*/
@ApiOperation
(
value
=
"首页API接口"
,
notes
=
"首页API接口"
,
httpMethod
=
"POST"
)
@ApiIgnore
@ApiOperation
(
value
=
"查询多条礼遇计划"
,
notes
=
"礼遇计划列表"
,
httpMethod
=
"POST"
)
@PostMapping
(
"/list"
)
public
ResponseBase
list
(
@RequestBody
Plan
plan
,
Pagination
pagination
)
{
...
...
src/main/java/com/servicemall/systemcommon/data/ErrorEnum.java
View file @
500cc3aa
...
...
@@ -11,9 +11,8 @@ public enum ErrorEnum {
/**
* 公共返回码
**/
E_100
(
1
00
,
"成功"
),
E_100
(
2
00
,
"成功"
),
E_200
(
200
,
"请求的服务不存在"
),
E_201
(
201
,
"请求次数超限或者过于频繁,暂时封禁"
),
E_202
(
202
,
"请求参数缺少必要字段"
),
E_203
(
203
,
"json格式有误"
),
...
...
@@ -28,7 +27,8 @@ public enum ErrorEnum {
E_401
(
401
,
"业务逻辑错误"
),
E_402
(
402
,
"数据库错误"
),
E_403
(
403
,
"文件操作错误"
),
E_404
(
404
,
"调用第三方接口异常"
),
E_404
(
404
,
"请求的服务不存在"
),
E_405
(
405
,
"调用第三方接口异常"
),
E_500
(
500
,
"记录未发现"
),
E_501
(
501
,
"数据库中存在重复的记录"
),
...
...
src/main/java/team/bangbang/common/data/StatusCode.java
0 → 100644
View file @
500cc3aa
package
team
.
bangbang
.
common
.
data
;
/**
* 状态码
*
* @author 帮帮组
* @version 1.0 2018年9月29日
*/
public
final
class
StatusCode
{
/**
* 成功
*/
public
static
final
int
SUCCESS
=
200
;
/**
* 20X段服务调用 - 请求次数超限,暂时封禁
*/
public
static
final
int
SERVICE_REQUEST_OUT_LIMIT
=
201
;
/**
* 20X段服务调用 - 请求参数缺少必要字段
*/
public
static
final
int
SERVICE_FIELD_EXPECTED
=
202
;
/**
* 20X段服务调用 - 请求参数JSON格式有误
*/
public
static
final
int
SERVICE_ERROR_JSON
=
203
;
/**
* 30X段权限 - 无权限
*/
public
static
final
int
PERMISSION_DENIED
=
300
;
/**
* 30X段权限 - Token过期
*/
public
static
final
int
PERMISSION_EXPIRED_TOKEN
=
301
;
/**
* 30X段权限 - 验签失败
*/
public
static
final
int
PERMISSION_INVALID_SIGN
=
302
;
/**
* 30X段权限 - IP无效
*/
public
static
final
int
PERMISSION_INVALID_IP
=
303
;
/**
* 40X段错误 - 网络错误
*/
public
static
final
int
ERROR_NETWORK
=
400
;
/**
* 40X段错误 - 业务逻辑错误
*/
public
static
final
int
ERROR_LOGIC
=
401
;
/**
* 40X段错误 - 数据库错误
*/
public
static
final
int
ERROR_DATABASE
=
402
;
/**
* 40X段错误 - 文件读写错误
*/
public
static
final
int
ERROR_FILE_OPERATE
=
403
;
/**
* 40X段服务调用 - 请求的服务不存在
*/
public
static
final
int
SERVICE_NOT_EXIST
=
404
;
/**
* 40X段错误 - 调用第三方接口异常
*/
public
static
final
int
ERROR_THIRD_SERVICE
=
405
;
/**
* 50X数据操作 - 记录未发现
*/
public
static
final
int
DATA_NOT_FOUND
=
500
;
/**
* 50X数据操作 - 重复的记录
*/
public
static
final
int
DATA_DUPLICATE
=
501
;
/**
* 50X数据操作 - 空白的结果
*/
public
static
final
int
DATA_BLANK
=
502
;
/**
* 50X数据操作 - 系统保护数据
*/
public
static
final
int
DATA_PROTECTED
=
503
;
/**
* 100X操作账户相关 - 账号或者密码错误
*/
public
static
final
int
USER_LOGIN_FAILED
=
1000
;
/**
* 100X操作账户相关 - 账号已经被禁用
*/
public
static
final
int
USER_DISABLED
=
1001
;
/**
* 100X操作账户相关 - 没有登录或者长时间未操作导致登录信息丢失
*/
public
static
final
int
USER_IDENTITY_MISS
=
1002
;
/**
* 999X日志级别 - DEBUG
*/
public
static
final
int
LOG_DEBUG
=
9990
;
/**
* 999X日志级别 - INFO
*/
public
static
final
int
LOG_INFO
=
9991
;
/**
* 999X日志级别 - WARN
*/
public
static
final
int
LOG_WARN
=
9992
;
/**
* 999X日志级别 - ERROR
*/
public
static
final
int
LOG_ERROR
=
9993
;
/**
* 999X日志级别 - FATAL
*/
public
static
final
int
LOG_FATAL
=
9994
;
}
src/main/java/team/bangbang/common/data/response/ResponseBase.java
0 → 100644
View file @
500cc3aa
package
team
.
bangbang
.
common
.
data
.
response
;
import
com.alibaba.fastjson.JSONObject
;
import
team.bangbang.common.data.StatusCode
;
/**
* HTTP接口响应数据
*
*
* @author 帮帮组
* @version 1.0 2017年9月6日
*/
public
class
ResponseBase
{
/** 成功 */
public
static
final
ResponseBase
SUCCESS
=
new
ResponseBase
(
StatusCode
.
SUCCESS
,
"成功"
);
/** 20X段服务调用 - 请求的服务不存在 */
public
static
final
ResponseBase
SERVICE_NOT_EXIST
=
new
ResponseBase
(
StatusCode
.
SERVICE_NOT_EXIST
,
"请求的服务不存在"
);
/** 20X段服务调用 - 请求次数超限,暂时封禁 */
public
static
final
ResponseBase
SERVICE_REQUEST_OUT_LIMIT
=
new
ResponseBase
(
StatusCode
.
SERVICE_REQUEST_OUT_LIMIT
,
"请求次数超限或者过于频繁,暂时封禁"
);
/** 20X段服务调用 - 请求参数缺少必要字段 */
public
static
final
ResponseBase
SERVICE_FIELD_EXPECTED
=
new
ResponseBase
(
StatusCode
.
SERVICE_FIELD_EXPECTED
,
"请求参数缺少必要字段"
);
/** 30X段权限 - 无权限*/
public
static
final
ResponseBase
PERMISSION_DENIED
=
new
ResponseBase
(
StatusCode
.
PERMISSION_DENIED
,
"当前操作无权限"
);
/** 30X段权限 - Token过期 */
public
static
final
ResponseBase
PERMISSION_EXPIRED_TOKEN
=
new
ResponseBase
(
StatusCode
.
PERMISSION_EXPIRED_TOKEN
,
"Token过期"
);
/** 30X段权限 - 验签失败 */
public
static
final
ResponseBase
PERMISSION_INVALID_SIGN
=
new
ResponseBase
(
StatusCode
.
PERMISSION_INVALID_SIGN
,
"签名sign无效"
);
/** 30X段权限 - IP无效 */
public
static
final
ResponseBase
PERMISSION_INVALID_IP
=
new
ResponseBase
(
StatusCode
.
PERMISSION_INVALID_IP
,
"请求IP不被允许"
);
/** 40X段错误 - 网络错误 */
public
static
final
ResponseBase
ERROR_NETWORK
=
new
ResponseBase
(
StatusCode
.
ERROR_NETWORK
,
"网络错误"
);
/** 40X段错误 - 业务逻辑错误 */
public
static
final
ResponseBase
ERROR_LOGIC
=
new
ResponseBase
(
StatusCode
.
ERROR_LOGIC
,
"业务逻辑错误"
);
/** 40X段错误 - 数据库错误 */
public
static
final
ResponseBase
ERROR_DATABASE
=
new
ResponseBase
(
StatusCode
.
ERROR_DATABASE
,
"数据库错误"
);
/** 40X段错误 - 文件读写错误 */
public
static
final
ResponseBase
ERROR_FILE_OPERATE
=
new
ResponseBase
(
StatusCode
.
ERROR_FILE_OPERATE
,
"文件操作错误"
);
/** 50X数据操作 - 记录未发现 */
public
static
final
ResponseBase
DATA_NOT_FOUND
=
new
ResponseBase
(
StatusCode
.
DATA_NOT_FOUND
,
"记录未发现"
);
/** 50X数据操作 - 重复的记录 */
public
static
final
ResponseBase
DATA_DUPLICATE
=
new
ResponseBase
(
StatusCode
.
DATA_DUPLICATE
,
"数据库中存在重复的记录"
);
/** 50X数据操作 - 空白的结果 */
public
static
final
ResponseBase
DATA_BLANK
=
new
ResponseBase
(
StatusCode
.
DATA_BLANK
,
"无数据"
);
/** 50X数据操作 - 系统保护数据 */
public
static
final
ResponseBase
DATA_PROTECTED
=
new
ResponseBase
(
StatusCode
.
DATA_PROTECTED
,
"系统保护数据,不可修改或删除"
);
/** 100X操作账户相关 - 账号或者密码错误 */
public
static
final
ResponseBase
USER_LOGIN_FAILED
=
new
ResponseBase
(
StatusCode
.
USER_LOGIN_FAILED
,
"账号或者密码错误"
);
/** 100X操作账户相关 - 账号已经被禁用 */
public
static
final
ResponseBase
USER_DISABLED
=
new
ResponseBase
(
StatusCode
.
USER_DISABLED
,
"账号已经被禁用"
);
/** 100X操作账户相关 - 没有登录或者长时间未操作导致登录信息丢失 */
public
static
final
ResponseBase
USER_IDENTITY_MISS
=
new
ResponseBase
(
StatusCode
.
USER_IDENTITY_MISS
,
"没有登录或者长时间未操作导致登录信息丢失"
);
/* 状态码 */
private
int
statusCode
=
0
;
/* 消息 */
private
String
message
=
null
;
/**
* 成功响应数据
*/
public
ResponseBase
()
{
// 默认使用成功的状态吗
statusCode
=
StatusCode
.
SUCCESS
;
}
/**
* @param statusCode 状态码
* @param message 结果消息
*/
public
ResponseBase
(
int
statusCode
,
String
message
)
{
this
.
statusCode
=
statusCode
;
this
.
message
=
message
;
}
/**
* 设置响应状态码、消息
*
* @param responseBase 响应信息
*
* @return 响应信息
*/
public
ResponseBase
set
(
ResponseBase
responseBase
)
{
setStatusCode
(
responseBase
.
statusCode
);
setMessage
(
responseBase
.
message
);
return
this
;
}
/**
* @return 状态码
*/
public
int
getStatusCode
()
{
return
statusCode
;
}
/**
* @param statusCode 状态码
*/
public
void
setStatusCode
(
int
statusCode
)
{
this
.
statusCode
=
statusCode
;
}
/**
* @return 消息
*/
public
String
getMessage
()
{
return
message
;
}
/**
* @param message 消息
*/
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
/**
* @return 转变为JSON字符串
*/
public
String
toString
()
{
return
JSONObject
.
toJSONString
(
this
);
}
}
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