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 04e860fb
authored
May 07, 2022
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
开发大数据研判报警消费逻辑
1 parent
728193bc
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
165 additions
and
5 deletions
src/main/java/cn/com/glsx/stdinterface/api/VehicleDeviceClient.java
src/main/java/cn/com/glsx/stdinterface/api/VehicleServiceClient.java
src/main/java/cn/com/glsx/stdinterface/dto/VehicleDeviceDto.java
src/main/java/cn/com/glsx/stdinterface/factory/VehicleDeviceFallbackFactory.java
src/main/java/cn/com/glsx/stdinterface/fallback/VehicleDeviceFallbackImpl.java
src/main/java/cn/com/glsx/stdinterface/api/VehicleDeviceClient.java
0 → 100644
View file @
04e860f
package
cn
.
com
.
glsx
.
stdinterface
.
api
;
import
cn.com.glsx.stdinterface.dto.VehicleDeviceDto
;
import
cn.com.glsx.stdinterface.factory.VehicleDeviceFallbackFactory
;
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.RequestParam
;
/**
* Vehicle feign
*
* @author yangll
*/
@FeignClient
(
name
=
"ne-shield-standard-interfaces"
,
path
=
"/nesi/vehicledevice"
,
fallbackFactory
=
VehicleDeviceFallbackFactory
.
class
,
decode404
=
true
)
public
interface
VehicleDeviceClient
{
/**
* 通过设备号获取车辆设备绑定关系
*
* @param sn 设备号
* @return
*/
@GetMapping
(
value
=
"/getVehicleDeviceBySn"
)
R
<
VehicleDeviceDto
>
getVehicleDeviceBySn
(
@RequestParam
String
sn
);
}
src/main/java/cn/com/glsx/stdinterface/api/VehicleServiceClient.java
View file @
04e860f
...
@@ -10,8 +10,12 @@ import org.springframework.web.bind.annotation.PostMapping;
...
@@ -10,8 +10,12 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
@FeignClient
(
name
=
"ne-shield-standard-interfaces"
,
path
=
"/nesi/vehicle"
,
/**
fallbackFactory
=
VehicleServiceFallbackFactory
.
class
,
decode404
=
true
)
* Vehicle feign
*
* @author yangll
*/
@FeignClient
(
name
=
"ne-shield-standard-interfaces"
,
path
=
"/nesi/vehicle"
,
fallbackFactory
=
VehicleServiceFallbackFactory
.
class
,
decode404
=
true
)
public
interface
VehicleServiceClient
{
public
interface
VehicleServiceClient
{
/**
/**
...
@@ -21,7 +25,7 @@ public interface VehicleServiceClient {
...
@@ -21,7 +25,7 @@ public interface VehicleServiceClient {
* @return
* @return
*/
*/
@GetMapping
(
value
=
"/bysn"
)
@GetMapping
(
value
=
"/bysn"
)
public
R
<
VehicleDto
>
getVehicleBySn
(
@RequestParam
String
sn
);
R
<
VehicleDto
>
getVehicleBySn
(
@RequestParam
String
sn
);
/**
/**
* 验证设备组合接口
* 验证设备组合接口
...
@@ -30,6 +34,5 @@ public interface VehicleServiceClient {
...
@@ -30,6 +34,5 @@ public interface VehicleServiceClient {
* @return
* @return
*/
*/
@PostMapping
(
value
=
"/verifyDevicesCompose"
)
@PostMapping
(
value
=
"/verifyDevicesCompose"
)
public
R
verifyDevicesCompose
(
@RequestBody
DevicesComposeVerifyBO
verifyBO
);
R
verifyDevicesCompose
(
@RequestBody
DevicesComposeVerifyBO
verifyBO
);
}
}
src/main/java/cn/com/glsx/stdinterface/dto/VehicleDeviceDto.java
0 → 100644
View file @
04e860f
package
cn
.
com
.
glsx
.
stdinterface
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 车辆设备绑定关系
*/
@Data
public
class
VehicleDeviceDto
{
/**
* id
*/
private
Long
id
;
/**
* 车辆id
*/
private
Long
vehicleId
;
/**
* 设备sn
*/
private
String
sn
;
/**
* 绑定状态:1绑定,2解绑
*/
private
Integer
bindStatus
;
/**
* 试驾类型 0:非试驾设备, 1,试驾设备
*/
private
Integer
trialType
;
/**
* 历史试驾类型 0:曾经不是试驾设备; 1:曾经是试驾设备
*/
private
Integer
hisType
;
/**
* 有线无线类型:1有线,0无线
*/
private
Integer
wireType
;
/**
* 激活上点时间
*/
private
Date
activeLocationDate
;
/**
* 激活上点经度
*/
private
String
activeLocationLng
;
/**
* 激活上点纬度
*/
private
String
activeLocationLat
;
/**
* 激活上点类型 0、GPS,1、基站
*/
private
Integer
activeLocationType
;
/**
* 激活上点地址
*/
private
String
activeLocationAddress
;
/**
* 删除标识
*/
private
Integer
delFlag
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createdDate
;
private
Long
createdBy
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
updatedDate
;
private
Long
updatedBy
;
}
\ No newline at end of file
\ No newline at end of file
src/main/java/cn/com/glsx/stdinterface/factory/VehicleDeviceFallbackFactory.java
0 → 100644
View file @
04e860f
package
cn
.
com
.
glsx
.
stdinterface
.
factory
;
import
cn.com.glsx.stdinterface.api.VehicleDeviceClient
;
import
cn.com.glsx.stdinterface.fallback.VehicleDeviceFallbackImpl
;
import
feign.hystrix.FallbackFactory
;
import
org.springframework.stereotype.Component
;
/**
* VehicleDevice 工厂类
*
* @author yangll
*/
@Component
public
class
VehicleDeviceFallbackFactory
implements
FallbackFactory
<
VehicleDeviceClient
>
{
@Override
public
VehicleDeviceClient
create
(
Throwable
throwable
)
{
VehicleDeviceFallbackImpl
fallback
=
new
VehicleDeviceFallbackImpl
();
fallback
.
setCause
(
throwable
);
return
fallback
;
}
}
src/main/java/cn/com/glsx/stdinterface/fallback/VehicleDeviceFallbackImpl.java
0 → 100644
View file @
04e860f
package
cn
.
com
.
glsx
.
stdinterface
.
fallback
;
import
cn.com.glsx.stdinterface.api.VehicleDeviceClient
;
import
cn.com.glsx.stdinterface.dto.VehicleDeviceDto
;
import
com.glsx.plat.core.web.R
;
import
lombok.Setter
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
@Slf4j
@Component
public
class
VehicleDeviceFallbackImpl
implements
VehicleDeviceClient
{
@Setter
private
Throwable
cause
;
@Override
public
R
<
VehicleDeviceDto
>
getVehicleDeviceBySn
(
String
sn
)
{
log
.
warn
(
"getVehicleDeviceBySn 熔断啦 {}"
,
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