|
|
|
@ -9,6 +9,7 @@ import com.xydl.cac.model.SensorDetail;
|
|
|
|
|
import com.xydl.cac.model.SensorUpdateModel;
|
|
|
|
|
import com.xydl.cac.repository.ModevRepository;
|
|
|
|
|
import com.xydl.cac.repository.NSensorRepository;
|
|
|
|
|
import com.xydl.cac.repository.WarnRuleRepository;
|
|
|
|
|
import com.xydl.cac.service.*;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
@ -45,6 +46,8 @@ public class NSensorServiceImpl implements NSensorService {
|
|
|
|
|
ModevTypePointService modevTypePointService;
|
|
|
|
|
@Resource
|
|
|
|
|
ModevRepository modevRepository;
|
|
|
|
|
@Resource
|
|
|
|
|
WarnRuleRepository ruleRepository;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<NSensor> listAll(Integer zsbid) throws Exception {
|
|
|
|
@ -132,7 +135,11 @@ public class NSensorServiceImpl implements NSensorService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void delete(Integer id) {
|
|
|
|
|
public void delete(Integer id) throws Exception {
|
|
|
|
|
List<WarnRule> list = ruleRepository.findBySensorId(id);
|
|
|
|
|
if (!CollectionUtils.isEmpty(list)) {
|
|
|
|
|
throw new BusinessException("该监测装置已配置告警规则,请先删除对应的规则后再来操作");
|
|
|
|
|
}
|
|
|
|
|
repository.deleteById(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|