@ -111,7 +111,7 @@ public class WarnRule {
}
public boolean canDo() {
if (active != null && active.intValue() == 1 && actualComp != null) {
if (active != null && active.intValue() == 1 && actualComp != null && nSensor != null) {
return true;
return false;
@ -152,7 +152,7 @@ public class NSensorServiceImpl implements NSensorService {
public NSensor detail(Integer id) throws Exception {
Optional<NSensor> optional = repository.findById(id);
if (!optional.isPresent()) {
throw new BusinessException("未找到该装置id=" + id);
return null;
NSensor sensor = optional.get();
this.fillOtherName(sensor);
@ -58,6 +58,9 @@ public class WarnRuleServiceImpl implements WarnRuleService {
item.setId(null);
item.setLastDTime(null);
NSensor sensor = sensorService.detail(item.getSensorId());
if (sensor == null){
throw new BusinessException("未找到该装置id=" + item.getSensorId());
Optional<ModevTypePoint> optionalModevTypePoint = typePointRepository.findById(item.getModevtypePointId());
if (!optionalModevTypePoint.isPresent()) {
throw new BusinessException("未找到该监测装置类型(" + sensor.getTypeName() + ")的属性点" + item.getModevtypePointId());