|
@@ -7,12 +7,14 @@ import cn.seecoder.data.server.repository.CoderRepository;
|
|
|
import cn.seecoder.data.server.service.ExtractionLogService;
|
|
import cn.seecoder.data.server.service.ExtractionLogService;
|
|
|
import cn.seecoder.data.server.utils.aspects.dataExtraction.DataExtractor;
|
|
import cn.seecoder.data.server.utils.aspects.dataExtraction.DataExtractor;
|
|
|
import cn.seecoder.data.server.utils.enums.ErrorCodeEnum;
|
|
import cn.seecoder.data.server.utils.enums.ErrorCodeEnum;
|
|
|
|
|
+import cn.seecoder.data.server.utils.enums.TimeType;
|
|
|
import cn.seecoder.data.server.utils.exception.GlobalException;
|
|
import cn.seecoder.data.server.utils.exception.GlobalException;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.core.ParameterizedTypeReference;
|
|
import org.springframework.core.ParameterizedTypeReference;
|
|
|
import org.springframework.http.HttpMethod;
|
|
import org.springframework.http.HttpMethod;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
import org.springframework.web.client.RestTemplate;
|
|
@@ -38,15 +40,15 @@ public class CoderSchedule {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private RestTemplate restTemplate;
|
|
private RestTemplate restTemplate;
|
|
|
|
|
|
|
|
- private final String source1 = "coder1";
|
|
|
|
|
|
|
+ private final String source = "coder";
|
|
|
|
|
|
|
|
// @Scheduled(cron = "00 00 00 * * ?")
|
|
// @Scheduled(cron = "00 00 00 * * ?")
|
|
|
- @DataExtractor(source1)
|
|
|
|
|
|
|
+ @DataExtractor(source)
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void coderDataExtraction() throws Exception {
|
|
public void coderDataExtraction() throws Exception {
|
|
|
- LocalDateTime start = extractionLogService.getExtractionStartTime(source1,1);
|
|
|
|
|
- LocalDateTime middle = extractionLogService.getExtractionStartTime(source1);
|
|
|
|
|
- LocalDateTime end = extractionLogService.getExtractionEndTime(source1);
|
|
|
|
|
|
|
+ LocalDateTime start = extractionLogService.getExtractionStartTime(source,1, TimeType.DAY);
|
|
|
|
|
+ LocalDateTime middle = extractionLogService.getExtractionStartTime(source);
|
|
|
|
|
+ LocalDateTime end = extractionLogService.getExtractionEndTime(source);
|
|
|
|
|
|
|
|
Map<String,String> param1 = new HashMap<>();
|
|
Map<String,String> param1 = new HashMap<>();
|
|
|
param1.put("startTime",start.toString());
|
|
param1.put("startTime",start.toString());
|
|
@@ -59,11 +61,11 @@ public class CoderSchedule {
|
|
|
System.out.println(param2);
|
|
System.out.println(param2);
|
|
|
|
|
|
|
|
|
|
|
|
|
- String coderApi1 = "/xxx?startTime={startTime}&endTime={endTime}";
|
|
|
|
|
|
|
+ String coderApi1 = "/api/statistic/getAnalysis?startAt={startTime}&endAt={endTime}";
|
|
|
String url = coderBaseUrl + coderApi1;
|
|
String url = coderBaseUrl + coderApi1;
|
|
|
ParameterizedTypeReference<Response<List<CoderDto>>> responseType = new ParameterizedTypeReference<Response<List<CoderDto>>>() {};
|
|
ParameterizedTypeReference<Response<List<CoderDto>>> responseType = new ParameterizedTypeReference<Response<List<CoderDto>>>() {};
|
|
|
|
|
|
|
|
- //再pull一次上次pull的时间段的数据,将一些遗漏的数据存入数据库
|
|
|
|
|
|
|
+ //上次抽取的时刻可能有些状态为RUNNING数据没抽取到,现在重复抽取上次抽取时刻的当天数据,把未抽取到的数据取到
|
|
|
List<CoderDto> source = getCoderApi1Data(url,param1,responseType);
|
|
List<CoderDto> source = getCoderApi1Data(url,param1,responseType);
|
|
|
source.forEach(data -> {
|
|
source.forEach(data -> {
|
|
|
CoderDao coderDao = coderRepository.findCoderDaoByRecordIdAndSubmitAt(data.getRecordId(),data.getSubmitAt());
|
|
CoderDao coderDao = coderRepository.findCoderDaoByRecordIdAndSubmitAt(data.getRecordId(),data.getSubmitAt());
|