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 87e1ce94
authored
Dec 18, 2021
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
开发新E盾gps基站调用基础接口
1 parent
b337f055
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
141 additions
and
0 deletions
src/main/java/cn/com/glsx/stdinterface/api/DeviceLocationClient.java
src/main/java/cn/com/glsx/stdinterface/dto/DeviceLocationDto.java
src/main/java/cn/com/glsx/stdinterface/factory/DeviceLocationFallbackFactory.java
src/main/java/cn/com/glsx/stdinterface/fallback/DeviceLocationFallbackImpl.java
src/main/java/cn/com/glsx/stdinterface/api/DeviceLocationClient.java
0 → 100644
View file @
87e1ce9
package
cn
.
com
.
glsx
.
stdinterface
.
api
;
import
cn.com.glsx.stdinterface.dto.DeviceLocationDto
;
import
cn.com.glsx.stdinterface.factory.DeviceLocationFallbackFactory
;
import
com.glsx.plat.core.web.R
;
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.RequestBody
;
import
java.util.Collection
;
import
java.util.List
;
/**
* 设备上点表调用Feign
*
* @author yll
*/
@FeignClient
(
name
=
"ne-shield-standard-interfaces"
,
path
=
"/stdinterface/devicelocation"
,
fallbackFactory
=
DeviceLocationFallbackFactory
.
class
,
decode404
=
true
)
public
interface
DeviceLocationClient
{
/**
* 插入或者更新设备上点数据
*
* @param deviceLocationDtos 设备上点集合
* @return
*/
@PostMapping
(
value
=
"/saveorupdatedevicelocationdata"
)
R
<
Integer
>
saveOrUpdateDeviceLocationData
(
@RequestBody
Collection
<
DeviceLocationDto
>
deviceLocationDtos
);
/**
* 获取E盾中的所有设备号集合
*/
@GetMapping
(
value
=
"getallsninneweshield"
)
R
<
List
<
String
>>
getAllSnInNewEshield
();
}
src/main/java/cn/com/glsx/stdinterface/dto/DeviceLocationDto.java
0 → 100644
View file @
87e1ce9
package
cn
.
com
.
glsx
.
stdinterface
.
dto
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 设备gps和基站报警时间表
*
* @author yll
*/
@Data
public
class
DeviceLocationDto
{
/**
* 主键id
*/
private
Integer
id
;
/**
* 设备号
*/
private
String
sn
;
/**
* 最后gps时间
*/
private
Date
lastGpsTime
;
/**
* 最后基站时间
*/
private
Date
lastBsTime
;
/**
* 创建时间
*/
private
Date
createdTime
;
/**
* 更新时间
*/
private
Date
updatedTime
;
}
\ No newline at end of file
\ No newline at end of file
src/main/java/cn/com/glsx/stdinterface/factory/DeviceLocationFallbackFactory.java
0 → 100644
View file @
87e1ce9
package
cn
.
com
.
glsx
.
stdinterface
.
factory
;
import
cn.com.glsx.stdinterface.api.ChannelRiskClient
;
import
cn.com.glsx.stdinterface.api.DeviceLocationClient
;
import
cn.com.glsx.stdinterface.fallback.ChannelRiskFallbackImpl
;
import
cn.com.glsx.stdinterface.fallback.DeviceLocationFallbackImpl
;
import
feign.hystrix.FallbackFactory
;
import
org.springframework.stereotype.Component
;
/**
* 设备上点服务调用异常处理工厂类
*
* @author yll
*/
@Component
public
class
DeviceLocationFallbackFactory
implements
FallbackFactory
<
DeviceLocationClient
>
{
@Override
public
DeviceLocationClient
create
(
Throwable
throwable
)
{
DeviceLocationFallbackImpl
fallback
=
new
DeviceLocationFallbackImpl
();
fallback
.
setCause
(
throwable
);
return
fallback
;
}
}
src/main/java/cn/com/glsx/stdinterface/fallback/DeviceLocationFallbackImpl.java
0 → 100644
View file @
87e1ce9
package
cn
.
com
.
glsx
.
stdinterface
.
fallback
;
import
cn.com.glsx.stdinterface.api.DeviceLocationClient
;
import
cn.com.glsx.stdinterface.dto.DeviceLocationDto
;
import
com.glsx.plat.core.web.R
;
import
lombok.Setter
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
java.util.Collection
;
import
java.util.List
;
/**
* 设备上点服务异常处理实现类
*
* @author yll
*/
@Slf4j
@Component
public
class
DeviceLocationFallbackImpl
implements
DeviceLocationClient
{
@Setter
private
Throwable
cause
;
@Override
public
R
<
Integer
>
saveOrUpdateDeviceLocationData
(
Collection
<
DeviceLocationDto
>
deviceLocationDtos
)
{
log
.
warn
(
"saveOrUpdateDeviceLocationData===熔断啦 {}"
,
cause
.
getMessage
());
return
R
.
ok
(
"服务异常"
);
}
@Override
public
R
<
List
<
String
>>
getAllSnInNewEshield
()
{
log
.
warn
(
"getAllSnInNewEshield===熔断啦 {}"
,
cause
.
getMessage
());
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