|
|
@ -121,11 +121,25 @@ public class NSensorServiceImpl implements NSensorService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public SensorDetail<Map<String, Object>> getDetail(ConditionModel model) throws Exception {
|
|
|
|
public SensorDetail<Map<String, Object>> getDetail(ConditionModel model) throws Exception {
|
|
|
|
|
|
|
|
NSensor sensor;
|
|
|
|
|
|
|
|
if (model.getId() != null) {
|
|
|
|
Optional<NSensor> optional = repository.findById(model.getId());
|
|
|
|
Optional<NSensor> optional = repository.findById(model.getId());
|
|
|
|
if (!optional.isPresent()) {
|
|
|
|
if (!optional.isPresent()) {
|
|
|
|
throw new BusinessException("未找到该装置");
|
|
|
|
throw new BusinessException("未找到该装置id=" + model.getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
NSensor sensor = optional.get();
|
|
|
|
sensor = optional.get();
|
|
|
|
|
|
|
|
} else if (model.getDevId() != null) {
|
|
|
|
|
|
|
|
List<NSensor> list = repository.findByDevId(model.getDevId());
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
|
|
|
|
|
throw new BusinessException("未找到该装置devId=" + model.getDevId());
|
|
|
|
|
|
|
|
} else if (list.size() > 1) {
|
|
|
|
|
|
|
|
throw new BusinessException("存在相同devId=" + model.getDevId() + "的多个装置,请先修正监测装置数据");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sensor = list.get(0);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
throw new BusinessException("缺少id或者eqmid信息");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (sensor.getTypeId() == null) {
|
|
|
|
if (sensor.getTypeId() == null) {
|
|
|
|
throw new BusinessException("该装置缺少类型id信息");
|
|
|
|
throw new BusinessException("该装置缺少类型id信息");
|
|
|
|
}
|
|
|
|
}
|
|
|
|