Commit 35e5e187 authored by 李灿灿's avatar 李灿灿

定时任务加入到Job服务中

parent 57a3f1fe
package com.yifu.cloud.plus.v1.yifu.common.dapr.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
/**
* @author licancan
* @description 商险模块dapr属性
* @date 2022-08-03 10:25:48
*/
@Data
@Component
@PropertySource("classpath:daprConfig.properties")
@ConfigurationProperties(value = "dapr.insurances", ignoreInvalidFields = false)
public class DaprInsurancesProperties {
/**
* dapr sidercar url 如:http://localhost:3511/v1.0/invoke/
*/
String appUrl;
/**
* app_id 如:"yifu_insurances_sider"
*/
String appId;
}
......@@ -12,3 +12,6 @@ dapr.check.appId=yifu-check
dapr.archives.appUrl=http://yifu-archives.qas-mvp.svc.cluster.local:3500/v1.0/invoke/
dapr.archives.appId=yifu-archives
dapr.insurances.appUrl=http://yifu-insurances.qas-mvp.svc.cluster.local:3511/v1.0/invoke/
dapr.insurances.appId=yifu-insurances
......@@ -47,10 +47,9 @@ public class TInsuranceDetailController {
* @param
* @return void
*/
@Operation(summary = "每日定时刷新商险到期数据", description = "每日定时刷新商险到期数据")
@SysLog("每日定时刷新商险到期数据")
@Inner
@GetMapping("/inner/updateOverdueByTask")
@PostMapping("/inner/updateOverdueByTask")
public void updateOverdueByTask() {
tInsuranceDetailService.updateOverdueByTask();
}
......
package com.yifu.cloud.plus.v1.job.compont;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprInsurancesProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* @author licancan
* @description 商险模块到期定时任务
* @date 2022-08-03 10:39:14
*/
@Component(value = "updateOverdueTask")
@Slf4j
@EnableConfigurationProperties(DaprInsurancesProperties.class)
public class UpdateOverdueTask {
@Resource
private DaprInsurancesProperties daprInsurancesProperties;
/**
* 更新商险到期定时任务
*
* @author licancan
* @param
* @return void
*/
public void updateOverdueTask() throws Exception {
log.info("-------------更新商险到期-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprInsurancesProperties.getAppUrl(),daprInsurancesProperties.getAppId(),"/insuranceDetail/inner/updateOverdueByTask","", Void.class, SecurityConstants.FROM_IN);
log.info("------------更新商险到期-定时任务结束------------");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment