package com.ruoyi.account.api.factory;
|
|
import com.ruoyi.account.api.feignClient.CompanyAllocateRecordClient;
|
import com.ruoyi.account.api.vo.CompanyAllocateSummaryVO;
|
import com.ruoyi.common.core.domain.R;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
import org.springframework.stereotype.Component;
|
|
import java.math.BigDecimal;
|
import java.util.List;
|
|
/**
|
* 公司额度分配记录服务降级处理
|
*
|
* @author mxcd
|
*/
|
@Component
|
public class CompanyAllocateRecordFallbackFactory implements FallbackFactory<CompanyAllocateRecordClient> {
|
|
private static final Logger log = LoggerFactory.getLogger(CompanyAllocateRecordFallbackFactory.class);
|
|
@Override
|
public CompanyAllocateRecordClient create(Throwable throwable) {
|
log.error("公司额度分配记录服务调用失败:{}", throwable.getMessage());
|
return new CompanyAllocateRecordClient() {
|
@Override
|
public R<Boolean> recordConsume(Integer companyId, Integer userType, String userInfo, String userName,
|
BigDecimal beforeBalance, BigDecimal amount, String chargingOrderCode,
|
String remark) {
|
return R.fail("写入消费流水失败:" + throwable.getMessage());
|
}
|
|
@Override
|
public R<List<String>> listConsumedOrderCodes(List<String> orderCodes) {
|
return R.fail("查询消费流水订单号失败:" + throwable.getMessage());
|
}
|
|
@Override
|
public R<CompanyAllocateSummaryVO> sumAllocatedBalance(Integer companyId) {
|
return R.fail("统计公司分配余额失败:" + throwable.getMessage());
|
}
|
|
@Override
|
public R<BigDecimal> recycleAllocatedBalance(Integer companyId, String operatorName, String companyName,
|
BigDecimal companyBalanceBefore) {
|
return R.fail("回收公司分配余额失败:" + throwable.getMessage());
|
}
|
};
|
}
|
}
|