package com.ruoyi.other.api.factory;
|
|
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.other.api.domain.TFleet;
|
import com.ruoyi.other.api.domain.TGroupCompany;
|
import com.ruoyi.other.api.feignClient.GroupCompanyClient;
|
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 GroupCompanyFallbackFactory implements FallbackFactory<GroupCompanyClient> {
|
|
private static final Logger log = LoggerFactory.getLogger(GroupCompanyFallbackFactory.class);
|
|
@Override
|
public GroupCompanyClient create(Throwable throwable) {
|
log.error("公司/车队服务调用失败:{}", throwable.getMessage());
|
return new GroupCompanyClient() {
|
|
@Override
|
public R<TGroupCompany> getCompanyById(Integer id) {
|
return R.fail("查询公司信息失败:" + throwable.getMessage());
|
}
|
|
@Override
|
public R<List<TGroupCompany>> listCompaniesByIds(List<Integer> ids) {
|
return R.fail("查询公司列表失败:" + throwable.getMessage());
|
}
|
|
@Override
|
public R<BigDecimal> deductBalance(Integer companyId, BigDecimal amount) {
|
return R.fail("扣减公司可用余额失败:" + throwable.getMessage());
|
}
|
|
@Override
|
public R<BigDecimal> refundBalance(Integer companyId, BigDecimal amount) {
|
return R.fail("退还公司可用余额失败:" + throwable.getMessage());
|
}
|
|
@Override
|
public R<BigDecimal> lockBalance(Integer companyId, BigDecimal amount) {
|
return R.fail("锁定公司金额失败:" + throwable.getMessage());
|
}
|
|
@Override
|
public R<BigDecimal> settleBalance(Integer companyId, BigDecimal lockedAmount, BigDecimal actualAmount,
|
String orderCode, String userInfo, String userName, String remark) {
|
return R.fail("结算公司金额失败:" + throwable.getMessage());
|
}
|
|
@Override
|
public R<BigDecimal> unlockBalance(Integer companyId, BigDecimal amount) {
|
return R.fail("释放公司锁定金额失败:" + throwable.getMessage());
|
}
|
|
@Override
|
public R<TFleet> getFleetById(Integer id) {
|
return R.fail("查询车队信息失败:" + throwable.getMessage());
|
}
|
|
@Override
|
public R<List<TFleet>> listFleetsByIds(List<Integer> ids) {
|
return R.fail("查询车队列表失败:" + throwable.getMessage());
|
}
|
};
|
}
|
}
|