fix: 定时服务,新增生产环境job服务。
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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("投资服务调用更新未出信用卡分期账单入账数据失败");
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -60,4 +60,9 @@ public class ServiceNameConstants
|
||||
* INTC_INVEST的serviceId
|
||||
*/
|
||||
public static final String INTC_INVEST ="intc-invest";
|
||||
|
||||
/**
|
||||
* INTC_INVEST_PROD的serviceId
|
||||
*/
|
||||
public static final String INTC_INVEST_PROD ="intc-invest-prod";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.ruoyi.job.task;
|
||||
|
||||
import com.ruoyi.api.invest.RemoteInvestProdService;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 照明平台定时任务
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Component("investProdJobTask")
|
||||
public class InvestProdJobTask
|
||||
{
|
||||
@Autowired
|
||||
private RemoteInvestProdService remoteInvestProdService;
|
||||
|
||||
/**生成未出信用卡账单数据*/
|
||||
public void generateUnpaidCreditBillTask(){
|
||||
System.out.println("================================开始生成未出账单数据("+ DateUtils.getTime() +")=================================");
|
||||
remoteInvestProdService.generateUnpaidCreditBillTask();
|
||||
System.out.println("================================结束生成未出账单据("+ DateUtils.getTime() +")=================================");
|
||||
}
|
||||
|
||||
/**未出信用卡分期账单入账数据*/
|
||||
public void updateUnpaidInstallmentDataTask(){
|
||||
System.out.println("================================开始更新未出信用卡分期账单入账数据("+ DateUtils.getTime() +")=================================");
|
||||
remoteInvestProdService.updateUnpaidInstallmentDataTask();
|
||||
System.out.println("================================结束更新未出信用卡分期账单入账拟数据("+ DateUtils.getTime() +")=================================");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user