瀏覽代碼

防止为空处理

wangmiaomiao 11 月之前
父節點
當前提交
d4ff64caaa
共有 1 個文件被更改,包括 2 次插入4 次删除
  1. 2 4
      slibra-admin/src/main/java/com/slibra/web/controller/business/WarningController.java

+ 2 - 4
slibra-admin/src/main/java/com/slibra/web/controller/business/WarningController.java

@@ -78,11 +78,9 @@ public class WarningController extends BaseController {
         //查询工业库 日报库 机器人化验库
         //查询工业库 日报库 机器人化验库
         List<TXinyiDaily> tXinyiDailies = this.dailyMapper.selectTXinyiDailyList(TXinyiDaily.builder().testDate(currentDateStr).build());
         List<TXinyiDaily> tXinyiDailies = this.dailyMapper.selectTXinyiDailyList(TXinyiDaily.builder().testDate(currentDateStr).build());
         List<TXinyiIndustry> tXinyiIndustries = this.industryMapper.selectTXinyiIndustryList(TXinyiIndustry.builder().testHour(currentHourStr).build());
         List<TXinyiIndustry> tXinyiIndustries = this.industryMapper.selectTXinyiIndustryList(TXinyiIndustry.builder().testHour(currentHourStr).build());
-        List<TXinyiRobot> tXinyiRobots = this.robotMapper.selectTXinyiRobotList(TXinyiRobot.builder().testHour(currentHourStr).build());
         //获取整点的那条数据,也就是第一条
         //获取整点的那条数据,也就是第一条
-        TXinyiDaily tXinyiDaily = tXinyiDailies.get(0);
-        TXinyiIndustry tXinyiIndustry = tXinyiIndustries.get(0);
-        TXinyiRobot tXinyiRobot = tXinyiRobots.get(0);
+        TXinyiDaily tXinyiDaily = CollectionUtils.isEmpty(tXinyiDailies) ? null : tXinyiDailies.get(0);
+        TXinyiIndustry tXinyiIndustry = CollectionUtils.isEmpty(tXinyiIndustries) ? null : tXinyiIndustries.get(0);
         //开始核对各个指标 并打印
         //开始核对各个指标 并打印
         if(!Objects.isNull(tXinyiIndustry)){
         if(!Objects.isNull(tXinyiIndustry)){
             //1 进水总磷超标报警
             //1 进水总磷超标报警