微调
This commit is contained in:
@@ -82,7 +82,7 @@ public class OfflineDataUploadController extends BaseController {
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "文件补召中,请稍后", methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "文件补召中失败", methodDescribe);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "文件补召失败", methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -220,70 +220,67 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
|
||||
|
||||
@Override
|
||||
public boolean startMakeUpData(MakeUpParam param) {
|
||||
boolean result = true;
|
||||
try {
|
||||
List<String> fileList = new ArrayList<>();
|
||||
//fixme 这边补召暂不支持多工程补召,防止下载文件时间过长,会出问题。
|
||||
String s = param.getProList().get(0);
|
||||
//稳态补招
|
||||
if (param.getDataTypeList().contains(0)) {
|
||||
String minPath = s + "/min";
|
||||
List<FileDto.DirInfo> projectInfoList = getFileList(param.getLineId(),param.getNDid(),minPath);
|
||||
if (CollectionUtil.isNotEmpty(projectInfoList)) {
|
||||
projectInfoList.forEach(item->{
|
||||
String linePath = item.getName();
|
||||
if (timeRange(param.getStartTime(),param.getEndTime(),linePath,"min")) {
|
||||
List<FileDto.DirInfo> lineDataList = getFileList(param.getLineId(),param.getNDid(),linePath);
|
||||
if (CollectionUtil.isNotEmpty(lineDataList)) {
|
||||
fileList.addAll(lineDataList.stream().map(FileDto.DirInfo::getName).collect(Collectors.toList()));
|
||||
}
|
||||
boolean result = false;
|
||||
List<String> fileList = new ArrayList<>();
|
||||
//fixme 这边补召暂不支持多工程补召,防止下载文件时间过长,会出问题。
|
||||
String s = param.getProList().get(0);
|
||||
//稳态补招
|
||||
if (param.getDataTypeList().contains(0)) {
|
||||
String minPath = s + "/min";
|
||||
List<FileDto.DirInfo> projectInfoList = getFileList(param.getLineId(),param.getNDid(),minPath);
|
||||
if (CollectionUtil.isNotEmpty(projectInfoList)) {
|
||||
projectInfoList.forEach(item->{
|
||||
String linePath = item.getName();
|
||||
if (timeRange(param.getStartTime(),param.getEndTime(),linePath,"min")) {
|
||||
List<FileDto.DirInfo> lineDataList = getFileList(param.getLineId(),param.getNDid(),linePath);
|
||||
if (CollectionUtil.isNotEmpty(lineDataList)) {
|
||||
fileList.addAll(lineDataList.stream().map(FileDto.DirInfo::getName).collect(Collectors.toList()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//暂态补招
|
||||
if (param.getDataTypeList().contains(1)) {
|
||||
//事件
|
||||
String logPath = s + "/log";
|
||||
List<FileDto.DirInfo> logList = getFileList(param.getLineId(),param.getNDid(),logPath);
|
||||
if (CollectionUtil.isNotEmpty(logList)) {
|
||||
logList.forEach(item->{
|
||||
if (timeRange(param.getStartTime(),param.getEndTime(),item.getName(),"log")) {
|
||||
fileList.add(item.getName());
|
||||
}
|
||||
});
|
||||
}
|
||||
//录波文件
|
||||
String comtradePath = s + "/comtrade";
|
||||
List<FileDto.DirInfo> comtradeList = getFileList(param.getLineId(),param.getNDid(),comtradePath);
|
||||
if (CollectionUtil.isNotEmpty(comtradeList)) {
|
||||
comtradeList.forEach(item->{
|
||||
if (timeRange(param.getStartTime(),param.getEndTime(),item.getName(),"comtrade")) {
|
||||
fileList.add(item.getName());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
//暂态补招
|
||||
if (param.getDataTypeList().contains(1)) {
|
||||
//事件
|
||||
String logPath = s + "/log";
|
||||
List<FileDto.DirInfo> logList = getFileList(param.getLineId(),param.getNDid(),logPath);
|
||||
if (CollectionUtil.isNotEmpty(logList)) {
|
||||
logList.forEach(item->{
|
||||
if (timeRange(param.getStartTime(),param.getEndTime(),item.getName(),"log")) {
|
||||
fileList.add(item.getName());
|
||||
}
|
||||
});
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(fileList)) {
|
||||
//添加record.bin文件
|
||||
fileList.add(s + "/record.bin");
|
||||
redisUtil.delete(AppRedisKey.MAKE_UP_FILES + param.getNDid());
|
||||
CsEquipmentDeliveryVO vo = equipmentFeignClient.queryEquipmentByndid(param.getNDid()).getData();
|
||||
DownloadMakeUpDto downloadMakeUpDto = new DownloadMakeUpDto();
|
||||
downloadMakeUpDto.setFileList(fileList);
|
||||
downloadMakeUpDto.setLineId(param.getLineId());
|
||||
downloadMakeUpDto.setDevId(vo.getId());
|
||||
downloadMakeUpDto.setAllStep(fileList.size());
|
||||
String proName = s.replace("/bd0/cmn/",OssPath.DEV_MAKE_UP_PATH + param.getNDid() + "/");
|
||||
downloadMakeUpDto.setEngineeringName(proName);
|
||||
redisUtil.saveByKey(AppRedisKey.MAKE_UP_FILES + param.getNDid(),downloadMakeUpDto);
|
||||
publisher.send("/makeUpData/" + param.getNDid() +"/" + param.getLineId(), "makeUpData", 1, false);
|
||||
log.info("下载的文件列表,{}",fileList);
|
||||
} else {
|
||||
throw new BusinessException("装置内未找到原始文件!");
|
||||
//录波文件
|
||||
String comtradePath = s + "/comtrade";
|
||||
List<FileDto.DirInfo> comtradeList = getFileList(param.getLineId(),param.getNDid(),comtradePath);
|
||||
if (CollectionUtil.isNotEmpty(comtradeList)) {
|
||||
comtradeList.forEach(item->{
|
||||
if (timeRange(param.getStartTime(),param.getEndTime(),item.getName(),"comtrade")) {
|
||||
fileList.add(item.getName());
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result = false;
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(fileList)) {
|
||||
//添加record.bin文件
|
||||
fileList.add(s + "/record.bin");
|
||||
redisUtil.delete(AppRedisKey.MAKE_UP_FILES + param.getNDid());
|
||||
CsEquipmentDeliveryVO vo = equipmentFeignClient.queryEquipmentByndid(param.getNDid()).getData();
|
||||
DownloadMakeUpDto downloadMakeUpDto = new DownloadMakeUpDto();
|
||||
downloadMakeUpDto.setFileList(fileList);
|
||||
downloadMakeUpDto.setLineId(param.getLineId());
|
||||
downloadMakeUpDto.setDevId(vo.getId());
|
||||
downloadMakeUpDto.setAllStep(fileList.size());
|
||||
String proName = s.replace("/bd0/cmn/",OssPath.DEV_MAKE_UP_PATH + param.getNDid() + "/");
|
||||
downloadMakeUpDto.setEngineeringName(proName);
|
||||
redisUtil.saveByKey(AppRedisKey.MAKE_UP_FILES + param.getNDid(),downloadMakeUpDto);
|
||||
publisher.send("/makeUpData/" + param.getNDid() +"/" + param.getLineId(), "makeUpData", 1, false);
|
||||
log.info("下载的文件列表,{}",fileList);
|
||||
result = true;
|
||||
} else {
|
||||
throw new BusinessException("装置内未找到原始文件!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user