|
|
|
@ -1,6 +1,8 @@
|
|
|
|
|
package com.xydl.cac.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.xydl.cac.entity.NSensor;
|
|
|
|
|
import com.xydl.cac.entity.Warning;
|
|
|
|
|
import com.xydl.cac.exception.BusinessException;
|
|
|
|
|
import com.xydl.cac.model.ConditionModel;
|
|
|
|
|
import com.xydl.cac.repository.WarningRepository;
|
|
|
|
|
import com.xydl.cac.service.WarningService;
|
|
|
|
@ -15,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
@Slf4j
|
|
|
|
@ -69,4 +72,15 @@ public class WarningServiceImpl implements WarningService {
|
|
|
|
|
};
|
|
|
|
|
return repository.findAll(specification);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateRead(Warning warning) throws Exception {
|
|
|
|
|
Optional<Warning> byId = repository.findById(warning.getId());
|
|
|
|
|
if (!byId.isPresent()) {
|
|
|
|
|
throw new BusinessException("未找到该告警" + warning.getId());
|
|
|
|
|
}
|
|
|
|
|
Warning war = byId.get();
|
|
|
|
|
war.setIsread(warning.getIsread());
|
|
|
|
|
repository.save(war);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|