增加卡启动判断
This commit is contained in:
parent
9a45032ff8
commit
566fe44613
@ -54,4 +54,9 @@ public class ServiceNameConstants {
|
||||
*/
|
||||
public static final String XHPC_PAYMENT = "xhpc-payment";
|
||||
|
||||
/**
|
||||
* 卡服务
|
||||
*/
|
||||
public static final String XHPC_CARD ="xhpc-card";
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
package com.xhpc.common.api;
|
||||
|
||||
import com.xhpc.common.api.factory.CardFallbackFactory;
|
||||
import com.xhpc.common.core.constant.ServiceNameConstants;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* 卡订单
|
||||
* @author yuyang
|
||||
* @date 2022/1/19 16:56
|
||||
*/
|
||||
@FeignClient(contextId ="cardService",value = ServiceNameConstants.XHPC_CARD, fallbackFactory = CardFallbackFactory.class)
|
||||
public interface CardService {
|
||||
|
||||
/**
|
||||
* 卡启动判断接口
|
||||
* @param cardNumber 卡号
|
||||
* @param serialNumber 终端编码
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/card/cardStartup")
|
||||
R cardStartup(@RequestParam(value = "cardNumber") String cardNumber, @RequestParam(value = "serialNumber") String serialNumber);
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.xhpc.common.api.factory;
|
||||
|
||||
import com.xhpc.common.api.CardService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2022/1/19 17:18
|
||||
*/
|
||||
@Component
|
||||
public class CardFallbackFactory implements FallbackFactory<CardService> {
|
||||
|
||||
@Override
|
||||
public CardService create(Throwable cause) {
|
||||
return new CardService() {
|
||||
@Override
|
||||
public R cardStartup(String cardNumber, String serialNumber) {
|
||||
return R.fail("卡启动判断接口失败:" + cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user