This commit is contained in:
@@ -26,8 +26,7 @@ public class AlarmRecordServiceImpl extends ServiceImpl<AlarmRecordMapper, Alarm
|
||||
|
||||
@Autowired
|
||||
private AlarmTaskOperatorService taskOperatorService;
|
||||
@Autowired
|
||||
private PrecautionaryMapper precautionaryMapper;
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
@@ -48,20 +47,10 @@ public class AlarmRecordServiceImpl extends ServiceImpl<AlarmRecordMapper, Alarm
|
||||
|
||||
List<AlarmRecord> newRecords = new ArrayList<>();
|
||||
List<AlarmRecord> updateRecords = new ArrayList<>();
|
||||
List<Precautionary> newList=new ArrayList<>();
|
||||
|
||||
|
||||
// 分类处理记录
|
||||
for (AlarmRecord record : records) {
|
||||
if (existingRecordMap.containsKey(record.getId())) {
|
||||
Precautionary precautionary = new Precautionary();
|
||||
precautionary.setType(1L);
|
||||
precautionary.setTime(record.getCallTime());
|
||||
precautionary.setAddress(record.getDeviceName());
|
||||
precautionary.setMsg("SOS终端接警");
|
||||
precautionary.setStatus(0L);
|
||||
precautionary.setTaskId(record.getId());
|
||||
newList.add(precautionary);
|
||||
// 如果记录已存在,检查是否需要更新
|
||||
AlarmRecord existing = existingRecordMap.get(record.getId());
|
||||
if (hasRecordChanges(existing, record)) {
|
||||
@@ -83,11 +72,6 @@ public class AlarmRecordServiceImpl extends ServiceImpl<AlarmRecordMapper, Alarm
|
||||
// 保存关联的操作记录
|
||||
}
|
||||
}
|
||||
// 批量插入主表记录
|
||||
if (!newList.isEmpty()) {
|
||||
precautionaryMapper.insertOrUpdateBatch(newList);
|
||||
}
|
||||
|
||||
// 批量更新修改过的记录
|
||||
if (!updateRecords.isEmpty()) {
|
||||
if (this.updateBatchById(updateRecords)) {
|
||||
|
Reference in New Issue
Block a user