|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.ping.chuan.ahpmsdp.xxljobexecutor.jobhandler; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.IOException; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.nio.file.Files; |
|
|
@ -67,7 +68,7 @@ public class TianQingRadarDataHandler { |
|
|
|
String param = XxlJobHelper.getJobParam(); |
|
|
|
ParamInfo paramInfo = objectMapper.readValue(param, ParamInfo.class); |
|
|
|
Map<String, Object> params = applicationCommon.prepareParams(paramInfo.getModeCode().toLowerCase()); |
|
|
|
LocalDateTime startTime = LocalDateTime.now().minusHours(8).minusHours(paramInfo.getTimeLength()); |
|
|
|
LocalDateTime startTime = LocalDateTime.now().minusHours(8).minusMinutes(paramInfo.getTimeLength()); |
|
|
|
LocalDateTime endTime = LocalDateTime.now().minusHours(8); |
|
|
|
TianQingResponse<List<TianQingFileVO>> tianQingResponse = request(String.format("[%s,%s]", startTime.format(TimeConstant.YYYYMMDDHHMM00), endTime.format(TimeConstant.YYYYMMDDHHMM00)), params); |
|
|
|
if (Objects.isNull(tianQingResponse)){ |
|
|
@ -168,11 +169,16 @@ public class TianQingRadarDataHandler { |
|
|
|
XxlJobHelper.log("开始下载文件:{}", dealInfo.getFileName()); |
|
|
|
boolean result = FileUtil.downloadByNetwork(dealInfo.getUrl(), dealInfo.getLocalPath()); |
|
|
|
if (result){ |
|
|
|
File file = new File(dealInfo.getLocalPath()); |
|
|
|
if (file.length() > 0){ |
|
|
|
XxlJobHelper.log("文件:{} 下载完成", dealInfo.getFileName()); |
|
|
|
targetDealInfos.put(dealInfo, entry); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
file.delete(); |
|
|
|
} |
|
|
|
|
|
|
|
dealInfo.setState(StateConstant.FAILED); |
|
|
|
XxlJobHelper.log("文件:{} 下载失败", dealInfo.getFileName()); |
|
|
|
dealInfo.setMessage(String.format("下载文件:%s失败",dealInfo.getFileName())); |
|
|
|