Commit 197939ae authored by 赵啸非's avatar 赵啸非

添加设备上线和下线的业务日志记录

parent cae84557
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("访问异常");
}
};
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment