fix: 定时服务,新增生产环境job服务。

This commit is contained in:
tianyongbao
2024-07-04 16:09:18 +08:00
parent 313130f700
commit 2359a7bd49
4 changed files with 113 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
package com.ruoyi.api.invest;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
* 基础服务
*
* @author YaphetS
*/
@FeignClient(contextId = "remoteInvestProdService", value = ServiceNameConstants.INTC_INVEST_PROD, fallbackFactory = com.ruoyi.api.invest.factory.RemoteInvestProdFallbackFactory.class)
public interface RemoteInvestProdService
{
/**
* 生成未出信用卡账单数据
*
* @return 结果
*/
@RequestMapping(value = "/job/generateUnpaidCreditBill",method = RequestMethod.POST)
public R generateUnpaidCreditBillTask();
/**
* 更新未出信用卡分期账单入账数据
*
* @return 结果
*/
@RequestMapping(value = "/job/updateUnpaidInstallmentData",method = RequestMethod.POST)
public R updateUnpaidInstallmentDataTask();
}

View File

@@ -0,0 +1,39 @@
package com.ruoyi.api.invest.factory;
import com.ruoyi.api.invest.RemoteInvestProdService;
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;
/**
* 用户服务降级处理
*
* @author ruoyi
*/
@Component
public class RemoteInvestProdFallbackFactory implements FallbackFactory<RemoteInvestProdService>
{
private static final Logger log = LoggerFactory.getLogger(RemoteInvestProdFallbackFactory.class);
@Override
public RemoteInvestProdService create(Throwable throwable)
{
log.error("投资服务调用失败:{}", throwable.getMessage());
return new RemoteInvestProdService()
{
@Override
public R generateUnpaidCreditBillTask() {
return R.fail("投资服务调用生成未出信用卡账单数据失败");
}
@Override
public R updateUnpaidInstallmentDataTask() {
return R.fail("投资服务调用更新未出信用卡分期账单入账数据失败");
}
};
}
}