Compare commits

...

3 Commits

Author SHA1 Message Date
阿斌
d140a4e80d
Pre Merge pull request !43 from 阿斌/N/A 2026-06-25 08:26:36 +00:00
lin
c73d6a1b27 处理全局异常 NoResourceFoundException 2026-06-25 16:26:22 +08:00
阿斌
42a85fbb07
修复生产厂商的gbManufacture少一个r导致设备厂商无法显示
Signed-off-by: 阿斌 <38912748@qq.com>
2025-12-03 10:50:05 +00:00
2 changed files with 13 additions and 1 deletions

View File

@ -11,6 +11,7 @@ import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.resource.NoResourceFoundException;
/** /**
* 全局异常处理 * 全局异常处理
@ -31,6 +32,17 @@ public class GlobalExceptionHandler {
return WVPResult.fail(ErrorCode.ERROR500.getCode(), e.getMessage()); return WVPResult.fail(ErrorCode.ERROR500.getCode(), e.getMessage());
} }
/**
* 默认异常处理
* @param e 异常
* @return 统一返回结果
*/
@ExceptionHandler(NoResourceFoundException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public WVPResult<String> exceptionHandler(NoResourceFoundException e) {
return WVPResult.fail(ErrorCode.ERROR404);
}
/** /**
* 默认异常处理 * 默认异常处理
* @param e 异常 * @param e 异常

View File

@ -89,7 +89,7 @@
<div class="infobox-content" v-if="channel"> <div class="infobox-content" v-if="channel">
<el-descriptions class="margin-top" :title="channel.gbName" :column="1" :colon="true" size="mini" :labelStyle="labelStyle" > <el-descriptions class="margin-top" :title="channel.gbName" :column="1" :colon="true" size="mini" :labelStyle="labelStyle" >
<el-descriptions-item label="编号" >{{channel.gbDeviceId}}</el-descriptions-item> <el-descriptions-item label="编号" >{{channel.gbDeviceId}}</el-descriptions-item>
<el-descriptions-item label="生产厂商">{{channel.gbManufacture}}</el-descriptions-item> <el-descriptions-item label="生产厂商">{{channel.gbManufacturer}}</el-descriptions-item>
<el-descriptions-item label="安装地址" >{{channel.gbAddress == null?'未知': channel.gbAddress}}</el-descriptions-item> <el-descriptions-item label="安装地址" >{{channel.gbAddress == null?'未知': channel.gbAddress}}</el-descriptions-item>
</el-descriptions> </el-descriptions>
<div style="padding-top: 10px; margin: 0 auto; width: fit-content;"> <div style="padding-top: 10px; margin: 0 auto; width: fit-content;">