Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-devicemonitor
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 56d4b900
authored
Sep 13, 2021
by
黄小葱
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改响应格式 swagger2
1 parent
7f3bc122
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
6 deletions
src/main/java/cn/com/glsx/devicemonitor/config/WebConfig.java
src/main/java/cn/com/glsx/devicemonitor/modules/api/DeviceApiController.java
src/main/java/cn/com/glsx/devicemonitor/modules/api/GpsBsApiController.java
src/main/java/cn/com/glsx/devicemonitor/config/WebConfig.java
0 → 100644
View file @
56d4b90
package
cn
.
com
.
glsx
.
devicemonitor
.
config
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
/**
* @author payu
*/
@Configuration
public
class
WebConfig
implements
WebMvcConfigurer
{
@Override
public
void
addResourceHandlers
(
ResourceHandlerRegistry
registry
)
{
registry
.
addResourceHandler
(
"swagger-ui.html"
).
addResourceLocations
(
"classpath:/META-INF/resources/"
);
registry
.
addResourceHandler
(
"/webjars/**"
).
addResourceLocations
(
"classpath:/META-INF/resources/webjars/"
);
}
}
\ No newline at end of file
src/main/java/cn/com/glsx/devicemonitor/modules/api/DeviceApiController.java
View file @
56d4b90
...
...
@@ -35,7 +35,7 @@ public class DeviceApiController {
* @param sn
* @return
*/
@GetMapping
(
value
=
"/getDeviceBySn"
,
consumes
=
MediaType
.
APPLICATION_
FORM_URLENCODED
_VALUE
)
@GetMapping
(
value
=
"/getDeviceBySn"
,
consumes
=
MediaType
.
APPLICATION_
JSON
_VALUE
)
public
R
getDeviceBySn
(
@NotBlank
(
message
=
"设备号不能为空"
)
@RequestParam
(
value
=
"sn"
)
String
sn
)
{
DeviceDTO
deviceDTO
=
deviceService
.
getDeviceDTOBySn
(
sn
);
return
R
.
ok
().
data
(
deviceDTO
);
...
...
@@ -49,7 +49,7 @@ public class DeviceApiController {
* @param offlineTime
* @return
*/
@GetMapping
(
value
=
"/getDeviceStatusBySn"
,
consumes
=
MediaType
.
APPLICATION_
FORM_URLENCODED
_VALUE
)
@GetMapping
(
value
=
"/getDeviceStatusBySn"
,
consumes
=
MediaType
.
APPLICATION_
JSON
_VALUE
)
public
R
getDeviceStatusBySn
(
@NotBlank
(
message
=
"设备号不能为空"
)
@RequestParam
(
value
=
"sn"
)
String
sn
,
Long
offlineTime
)
{
if
(
offlineTime
==
null
||
offlineTime
==
0
)
{
offlineTime
=
ConstantsDevice
.
OFFLINE_TIME_OTHER
;
...
...
@@ -65,7 +65,7 @@ public class DeviceApiController {
* @param sn 设备号
* @return
*/
@GetMapping
(
value
=
"/getDevicesTotalCount"
)
@GetMapping
(
value
=
"/getDevicesTotalCount"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
@SysLog
(
value
=
"获取设备上点总个数"
,
action
=
OperateType
.
QUERY
)
public
R
getDevicesTotalCount
(
@RequestParam
(
value
=
"sn"
)
String
sn
)
{
log
.
info
(
"开始查询设备上点总个数"
);
...
...
src/main/java/cn/com/glsx/devicemonitor/modules/api/GpsBsApiController.java
View file @
56d4b90
...
...
@@ -61,7 +61,7 @@ public class GpsBsApiController {
* @param deviceCode
* @return
*/
@GetMapping
(
value
=
"/single"
,
consumes
=
MediaType
.
APPLICATION_
FORM_URLENCODED
_VALUE
)
@GetMapping
(
value
=
"/single"
,
consumes
=
MediaType
.
APPLICATION_
JSON
_VALUE
)
public
R
getLastGpsBsBySn
(
@NotBlank
(
message
=
"设备号不能为空"
)
@RequestParam
(
value
=
"sn"
)
String
sn
,
@NotBlank
(
message
=
"设备编码不能为空"
)
@RequestParam
(
value
=
"deviceCode"
)
String
deviceCode
)
{
if
(!
DeviceTypeRelationEnum
.
findByDeviceCode
(
deviceCode
).
equals
(
DeviceTypeRelationEnum
.
GPS
))
{
return
R
.
error
(
BussinessExceptionEnum
.
UNSUPORT_DEVICE
.
getCode
(),
BussinessExceptionEnum
.
UNSUPORT_DEVICE
.
getMessage
());
...
...
@@ -76,7 +76,7 @@ public class GpsBsApiController {
* @param deviceCode
* @return
*/
@GetMapping
(
value
=
"/single/history"
,
consumes
=
MediaType
.
APPLICATION_
FORM_URLENCODED
_VALUE
)
@GetMapping
(
value
=
"/single/history"
,
consumes
=
MediaType
.
APPLICATION_
JSON
_VALUE
)
public
R
getLastGpsBsHistoryBySn
(
@NotBlank
(
message
=
"设备号不能为空"
)
@RequestParam
(
value
=
"sn"
)
String
sn
,
@NotBlank
(
message
=
"设备编码不能为空"
)
@RequestParam
(
value
=
"deviceCode"
)
String
deviceCode
,
@NotBlank
(
message
=
"开始时间不能为空"
)
@RequestParam
(
value
=
"startTime"
)
String
startTime
,
@NotBlank
(
message
=
"结束时间不能为空"
)
@RequestParam
(
value
=
"endTime"
)
String
endTime
)
{
if
(!
DeviceTypeRelationEnum
.
GPS
.
equals
(
DeviceTypeRelationEnum
.
findByDeviceCode
(
deviceCode
)))
{
...
...
@@ -92,7 +92,7 @@ public class GpsBsApiController {
* @return
*/
@ApiOperation
(
value
=
"车辆监控信息"
)
@GetMapping
(
value
=
"/devicemonitorinfo"
,
consumes
=
MediaType
.
APPLICATION_
FORM_URLENCODED
_VALUE
)
@GetMapping
(
value
=
"/devicemonitorinfo"
,
consumes
=
MediaType
.
APPLICATION_
JSON
_VALUE
)
public
R
listDeviceMonitorInfo
(
@NotBlank
(
message
=
"设备号不能为空"
)
@RequestParam
(
value
=
"sns"
)
String
sns
,
@NotBlank
(
message
=
"设备编码不能为空"
)
@RequestParam
(
value
=
"deviceCode"
)
String
deviceCode
)
{
if
(!
DeviceTypeRelationEnum
.
findByDeviceCode
(
deviceCode
).
equals
(
DeviceTypeRelationEnum
.
GPS
))
{
return
R
.
error
(
BussinessExceptionEnum
.
UNSUPORT_DEVICE
.
getCode
(),
BussinessExceptionEnum
.
UNSUPORT_DEVICE
.
getMessage
());
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment