修改:同步enc异常数据死循环问题修改
This commit is contained in:
@@ -121,11 +121,11 @@ public class LyricInternalNewServiceImpl {
|
||||
syncCount = simulationTaskExtraService.batchRemoveAndSaveExceptionData(newExceptionModels);
|
||||
} catch (Exception e) {
|
||||
log.error("batchRemoveAndSaveExceptionData error:{}", e.getMessage());
|
||||
processedCount += unsyncedExceptionTasks.size();
|
||||
continue;
|
||||
}
|
||||
syncTotalCount += syncCount;
|
||||
log.info("同步异常任务:第{}批次同步完成,本次同步{}条,累计同步{}条",
|
||||
pageNum, syncCount, syncTotalCount);
|
||||
log.info("同步异常任务:第{}批次同步完成,本次同步{}条,累计同步{}条", pageNum, syncCount, syncTotalCount);
|
||||
// 更新已处理数量和页码
|
||||
processedCount += unsyncedExceptionTasks.size();
|
||||
pageNum++;
|
||||
@@ -135,9 +135,7 @@ public class LyricInternalNewServiceImpl {
|
||||
} catch (Exception e) {
|
||||
log.error("batchRemoveSaveTaskEcns error:{}", e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
log.info("同步异常任务全部完成,总任务数{}条,累计同步异常数据{}条", total, syncTotalCount);
|
||||
return SdmResponse.success("同步成功,总任务数" + total + "条,累计同步了" + syncTotalCount + "条异常数据");
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -93,11 +94,11 @@ public class SimulationTaskExtraServiceImpl extends ServiceImpl<SimulationTaskEx
|
||||
LambdaQueryWrapper<SimulationTaskExtra> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(SimulationTaskExtra::getTaskId, taskIdList);
|
||||
// 3. 执行删除
|
||||
boolean remove = this.remove(queryWrapper);
|
||||
log.warn("batchSaveExceptionData before delete: {}", remove);
|
||||
if(!remove) {
|
||||
log.error("batchSaveExceptionData before delete failed");
|
||||
throw new RuntimeException("batchSaveExceptionData before delete failed");
|
||||
try {
|
||||
this.remove(queryWrapper);
|
||||
} catch (Exception e) {
|
||||
log.error("batchSaveExceptionData before delete exception:{}",e.getMessage());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// 构建扩展表数据
|
||||
List<SpdmNodeExtraReq> abnormalExtraList = new ArrayList<>();
|
||||
@@ -112,6 +113,9 @@ public class SimulationTaskExtraServiceImpl extends ServiceImpl<SimulationTaskEx
|
||||
abnormalExtra.setNodeId(model.getUuid());
|
||||
abnormalExtra.setPropertyName("abnormal");
|
||||
abnormalExtra.setPropertyValue("1");
|
||||
String currentDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
abnormalExtra.setCreateTime(currentDate);
|
||||
abnormalExtra.setUpdateTime(currentDate);
|
||||
abnormalExtraList.add(abnormalExtra);
|
||||
// // 构建异常详情扩展记录 异常的详情暂时不需要 项目号+工位号 查出来的异常非常多,如果存储的话需要注意
|
||||
// SpdmNodeExtraReq detailExtra = new SpdmNodeExtraReq();
|
||||
@@ -124,9 +128,9 @@ public class SimulationTaskExtraServiceImpl extends ServiceImpl<SimulationTaskEx
|
||||
// 批量插入异常标识
|
||||
if (CollectionUtils.isNotEmpty(abnormalExtraList)) {
|
||||
int abnormalCount = simulationTaskExtraMapper.addTaskExtraBatch(abnormalExtraList);
|
||||
if(abnormalCount <=0) {
|
||||
throw new RuntimeException("batchSaveExceptionData failed");
|
||||
}
|
||||
// if(abnormalCount <=0) {
|
||||
// throw new RuntimeException("batchSaveExceptionData failed");
|
||||
// }
|
||||
log.info("同步异常任务:批量插入异常标识{}条,成功{}条", abnormalExtraList.size(), abnormalCount);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user