Commit 0d59326a authored by 麻笑宇's avatar 麻笑宇

fix(amos-boot-module-statistics): 修复技术参数查询时的异常

- 在 queryTechParam 方法中增加了对 type 参数的空值检查 - 如果 type 参数为空,抛出 BadRequest 异常,提示用户需要先选择设备种类 -这个修改提高了系统稳定性,避免了空指针异常的发生
parent 02fa5621
......@@ -48,6 +48,7 @@ import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
......@@ -1698,6 +1699,9 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
}
public JSONArray queryTechParam(String type) {
if(ValidationUtil.isEmpty(type)){
throw new BadRequest("该条件需要优先选择设备种类,再进行尝试");
}
List<TechParamItem> paramMetaList = TechParamUtil.getParamMetaList(type);
JSONArray list = new JSONArray();
for (int i = 0; i < paramMetaList.size(); i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment