mitao
2024-09-04 ecca9ab70a9a87bcb60977c92fbf81053b8fc1bb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.ruoyi.order.api.factory;
 
import com.ruoyi.common.core.domain.R;
import com.ruoyi.order.api.entity.ServeRecord;
import com.ruoyi.order.api.feignClient.ServeRecordClient;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
 
/**
 * @author HJL
 */
@Component
public class ServeRecordFallbackFactory implements FallbackFactory<ServeRecordClient> {
 
    @Override
    public ServeRecordClient create(Throwable cause) {
        return new ServeRecordClient() {
            @Override
            public R<ServeRecord> serveRecordByOrderId(String orderId) {
                return R.fail(cause.getMessage());
            }
        };
    }
}