Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-standard-interfaces-api
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 08e75f25
authored
Apr 24, 2022
by
向延琳
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
查询电量
1 parent
01d4569a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
1 deletions
src/main/java/cn/com/glsx/stdinterface/api/BatteryClient.java
src/main/java/cn/com/glsx/stdinterface/dto/DevicePowerDTO.java
src/main/java/cn/com/glsx/stdinterface/fallback/BatteryFallbackImpl.java
src/main/java/cn/com/glsx/stdinterface/api/BatteryClient.java
View file @
08e75f2
...
@@ -4,7 +4,9 @@ import cn.com.glsx.stdinterface.dto.DevicePowerDTO;
...
@@ -4,7 +4,9 @@ import cn.com.glsx.stdinterface.dto.DevicePowerDTO;
import
cn.com.glsx.stdinterface.factory.FreqRecordFallbackFactory
;
import
cn.com.glsx.stdinterface.factory.FreqRecordFallbackFactory
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.core.web.R
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
/**
/**
* @author xiangyanlin
* @author xiangyanlin
...
@@ -21,4 +23,12 @@ public interface BatteryClient {
...
@@ -21,4 +23,12 @@ public interface BatteryClient {
*/
*/
@PostMapping
(
value
=
"/save"
)
@PostMapping
(
value
=
"/save"
)
R
saveBatteryInfo
(
DevicePowerDTO
devicePowerDTO
);
R
saveBatteryInfo
(
DevicePowerDTO
devicePowerDTO
);
/**
* 根据设备sn获取设备
* @param sn 设备号
* @return 设备电量
*/
@GetMapping
(
"/queryOneBySn"
)
R
<
DevicePowerDTO
>
getDevicePowerBySn
(
@RequestParam
(
"sn"
)
String
sn
);
}
}
src/main/java/cn/com/glsx/stdinterface/dto/DevicePowerDTO.java
View file @
08e75f2
package
cn
.
com
.
glsx
.
stdinterface
.
dto
;
package
cn
.
com
.
glsx
.
stdinterface
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.Column
;
...
@@ -44,6 +45,7 @@ public class DevicePowerDTO implements Serializable {
...
@@ -44,6 +45,7 @@ public class DevicePowerDTO implements Serializable {
/**
/**
* 创建时间|入库时间
* 创建时间|入库时间
*/
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createdDate
;
private
Date
createdDate
;
/**
/**
...
@@ -54,6 +56,7 @@ public class DevicePowerDTO implements Serializable {
...
@@ -54,6 +56,7 @@ public class DevicePowerDTO implements Serializable {
/**
/**
* 更新时间
* 更新时间
*/
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
updatedDate
;
private
Date
updatedDate
;
/**
/**
...
...
src/main/java/cn/com/glsx/stdinterface/fallback/BatteryFallbackImpl.java
View file @
08e75f2
...
@@ -20,7 +20,13 @@ public class BatteryFallbackImpl implements BatteryClient {
...
@@ -20,7 +20,13 @@ public class BatteryFallbackImpl implements BatteryClient {
@Override
@Override
public
R
saveBatteryInfo
(
DevicePowerDTO
devicePowerDTO
)
{
public
R
saveBatteryInfo
(
DevicePowerDTO
devicePowerDTO
)
{
log
.
warn
(
"DevicePowerDTO 熔断啦 {}"
,
cause
.
getMessage
());
log
.
warn
(
"saveBatteryInfo 熔断啦 {}"
,
cause
.
getMessage
());
return
R
.
ok
(
"服务异常"
);
}
@Override
public
R
<
DevicePowerDTO
>
getDevicePowerBySn
(
String
sn
)
{
log
.
warn
(
"getDevicePowerBySn 熔断啦 {}"
,
cause
.
getMessage
());
return
R
.
ok
(
"服务异常"
);
return
R
.
ok
(
"服务异常"
);
}
}
}
}
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