Commit 5ba6d6ed authored by suhuiguang's avatar suhuiguang

fix(设备创建) :数据比对

1.自动任务异常处理代码暂存
parent 058a7682
package com.yeejoin.amos.boot.module.jg.biz.job;
import cn.hutool.core.date.DateUtil;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.robot.AmosRequestContext;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.javacrumbs.shedlock.spring.annotation.SchedulerLock;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
......@@ -14,9 +12,7 @@ import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.client.RestTemplate;
import java.util.ArrayList;
......@@ -34,8 +30,6 @@ public class DataConsistencyJob {
private final AmosRequestContext requestContext;
private final IdxBizJgUseInfoMapper idxBizJgUseInfoMapper;
private final DiscoveryClient discoveryClient;
private final RestTemplate restTemplate; // 需要提前注入
......@@ -43,8 +37,8 @@ public class DataConsistencyJob {
@Value("${spring.application.name}")
private String applicationName;
@Scheduled(cron = "0 0 3 * * ?")
@SchedulerLock(name = "equipConsistencyJob", lockAtMostFor = "PT1H")
// @Scheduled(cron = "0 0 3 * * ?")
// @SchedulerLock(name = "equipConsistencyJob", lockAtMostFor = "PT1H")
public void execute() {
List<ServiceInstance> instanceList = discoveryClient.getInstances(applicationName);
int slots = instanceList.size();
......
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