perf: 优化各处报错提示信息

dev
huangfeng 3 months ago
parent 073321327b
commit 63a60caac6

@ -174,7 +174,7 @@ public class IcdConfigController extends BasicController {
}
Optional<IcdIed> optional = iedRepository.findById(iedId);
if (!optional.isPresent()) {
throw new BusinessException("未找到该IED");
throw new BusinessException("未找到该IED id=" + iedId);
}
IcdIed ied = optional.get();
try {
@ -201,7 +201,7 @@ public class IcdConfigController extends BasicController {
}
Optional<IcdIed> optional = iedRepository.findById(iedId);
if (!optional.isPresent()) {
throw new BusinessException("未找到该IED");
throw new BusinessException("未找到该IED id=" + iedId);
}
IcdIed ied = optional.get();
ied.setStart(Constants.FALSE);

@ -157,7 +157,7 @@ public class NSensorController extends BasicController {
String typename = "";
List<NSensor> list = sensorRepository.findByTypeId(model.getTypeId());
if (CollectionUtils.isEmpty(list)) {
throw new BusinessException("未找到该类型的装置");
throw new BusinessException("未找到该类型的装置typeId=" + model.getTypeId());
}
List<SensorDetail<Map<String, Object>>> detailList = new ArrayList<>();
for (NSensor sensor : list) {

@ -67,7 +67,7 @@ public class WarnRuleController extends BasicController {
} else if (Constants.Miss.equalsIgnoreCase(name)) {
return missCompare;
} else {
throw new BusinessException("未找到该比较器");
throw new BusinessException("未找到该比较器" + name);
}
}

@ -41,7 +41,7 @@ public class IecServerService {
public void startServer(Integer fileId, int port) throws BusinessException {
Optional<IcdFile> optional = fileRepository.findById(fileId);
if (!optional.isPresent()) {
throw new BusinessException("未找到该文件");
throw new BusinessException("未找到该文件fileId=" + fileId);
}
IcdFile icdFile = optional.get();
if (icdFile.getSrv() != Constants.Server) {
@ -94,7 +94,7 @@ public class IecServerService {
public List<IcdConfigTypeInst> listParamindex(Integer fileId) throws Exception {
Optional<IcdFile> optional = fileRepository.findById(fileId);
if (!optional.isPresent()) {
throw new BusinessException("未找到该文件");
throw new BusinessException("未找到该文件fileId=" + fileId);
}
IcdFile icdFile = optional.get();
if (icdFile.getSrv() != Constants.Server) {

@ -105,7 +105,7 @@ public class JgServiceImpl implements JgService {
item.setId(null);
Optional<Bdz> optionalBdz = bdzRepository.findById(item.getBdzid());
if (!optionalBdz.isPresent()) {
throw new BusinessException("未找到该变电站");
throw new BusinessException("未找到该变电站id=" + item.getBdzid());
}
List<Jg> list = repository.findByBdzidAndMc(item.getBdzid(), item.getMc());
if (!CollectionUtils.isEmpty(list)) {
@ -119,7 +119,7 @@ public class JgServiceImpl implements JgService {
public void update(Jg item) throws Exception {
Optional<Bdz> optionalBdz = bdzRepository.findById(item.getBdzid());
if (!optionalBdz.isPresent()) {
throw new BusinessException("未找到该变电站");
throw new BusinessException("未找到该变电站id=" + item.getBdzid());
}
List<Jg> list = repository.findByBdzidAndMcAndIdIsNot(item.getBdzid(), item.getMc(), item.getId());
if (!CollectionUtils.isEmpty(list)) {
@ -144,7 +144,7 @@ public class JgServiceImpl implements JgService {
public Jg detail(Integer id) throws Exception {
Optional<Jg> optional = repository.findById(id);
if (!optional.isPresent()) {
throw new BusinessException("未找到该区域");
throw new BusinessException("未找到该区域id=" + id);
}
Jg jg = optional.get();
Optional<Bdz> optionalBdz = bdzRepository.findById(jg.getBdzid());

@ -78,7 +78,7 @@ public class WarnRuleServiceImpl implements WarnRuleService {
public void update(WarnRule item) throws Exception {
Optional<WarnRule> optional = repository.findById(item.getId());
if (!optional.isPresent()) {
throw new BusinessException("未找到该告警规则");
throw new BusinessException("未找到该告警规则id=" + item.getId());
}
WarnRule rule = optional.get();
rule.setComparator(item.getComparator());

@ -97,7 +97,7 @@ public class WarningServiceImpl implements WarningService {
public void updateState(Warning warning) throws Exception {
Optional<Warning> byId = repository.findById(warning.getId());
if (!byId.isPresent()) {
throw new BusinessException("未找到该告警" + warning.getId());
throw new BusinessException("未找到该告警id=" + warning.getId());
}
Warning war = byId.get();
war.setState(warning.getState());

@ -93,7 +93,7 @@ public class ZsbServiceImpl implements ZsbService {
item.setBdzid(jg.getBdzid());
Optional<Lx> optionalLx = lxRepository.findById(item.getLxid());
if (!optionalLx.isPresent()) {
throw new BusinessException("未找到该设备类型");
throw new BusinessException("未找到该设备类型id=" + item.getLxid());
}
List<Zsb> list = repository.findByJgidAndMc(item.getJgid(), item.getMc());
if (!CollectionUtils.isEmpty(list)) {
@ -109,7 +109,7 @@ public class ZsbServiceImpl implements ZsbService {
item.setBdzid(jg.getBdzid());
Optional<Lx> optionalLx = lxRepository.findById(item.getLxid());
if (!optionalLx.isPresent()) {
throw new BusinessException("未找到该设备类型");
throw new BusinessException("未找到该设备类型id=" + item.getLxid());
}
List<Zsb> list = repository.findByJgidAndMcAndIdIsNot(item.getJgid(), item.getMc(), item.getId());
if (!CollectionUtils.isEmpty(list)) {

@ -26,8 +26,13 @@ public class ThermalCollectService {
try {
LoginModule.init(null, null);
NSensor sensor = list.get(0);
LoginModule.login(sensor.getIp(), sensor.getPort(), sensor.getUsername(), sensor.getPasswd());
log.info("登入到" + sensor.getIp() + ":" + sensor.getPort() + ", 用户名:" + sensor.getUsername());
boolean r = LoginModule.login(sensor.getIp(), sensor.getPort(), sensor.getUsername(), sensor.getPasswd());
if (r) {
log.info("登入成功" + sensor.getIp() + ":" + sensor.getPort() + ", 用户名:" + sensor.getUsername());
} else {
log.error("登入失败" + sensor.getIp() + ":" + sensor.getPort() + ", 用户名:" + sensor.getUsername());
return;
}
String time = DateUtil.format(new Date());
for (NSensor item : list) {
NetSDKLib.NET_RADIOMETRYINFO data = ThermalCameraModule.queryItemTemper(0, 0, sensor.getTmId(), sensor.getTmType());

Loading…
Cancel
Save