Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
device-new-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
device-new-platform
Commits
197939ae
Commit
197939ae
authored
Jun 21, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加设备上线和下线的业务日志记录
parent
cae84557
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
0 deletions
+56
-0
common-lib/src/main/java/com/mortals/xhx/feign/ISampleDeviceFeign.java
...c/main/java/com/mortals/xhx/feign/ISampleDeviceFeign.java
+56
-0
No files found.
common-lib/src/main/java/com/mortals/xhx/feign/ISampleDeviceFeign.java
0 → 100644
View file @
197939ae
package
com.mortals.xhx.feign
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.xhx.common.pdu.DeviceReq
;
import
feign.hystrix.FallbackFactory
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
/**
* 设备 Feign接口
*
* @author zxfei
* @date 2023-02-25
*/
@FeignClient
(
name
=
"sample-form-manager"
,
path
=
"/sampleform"
,
fallbackFactory
=
SampleDeviceFeignFallbackFactory
.
class
)
public
interface
ISampleDeviceFeign
extends
IFeign
{
/**
* 设备回调
*
* @param deviceReq
* @return
*/
@PostMapping
(
value
=
"/api/device/callback"
)
Rest
<
String
>
deviceCall
(
@RequestBody
DeviceReq
deviceReq
);
}
@Slf4j
@Component
class
SampleDeviceFeignFallbackFactory
implements
FallbackFactory
<
ISampleDeviceFeign
>
{
@Override
public
ISampleDeviceFeign
create
(
Throwable
t
)
{
return
new
ISampleDeviceFeign
()
{
@Override
public
Rest
<
String
>
deviceCall
(
DeviceReq
deviceReq
)
{
return
Rest
.
fail
(
"访问异常"
);
}
};
}
}
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