package com.huimv.admin.timer; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.huimv.admin.common.utils.NumberUtils; import com.huimv.admin.entity.ProtData; import com.huimv.admin.entity.ProtThreshold; import com.huimv.admin.entity.ProtWarningInfo; import com.huimv.admin.mapper.ProtDataMapper; import com.huimv.admin.mapper.ProtThresholdMapper; import com.huimv.admin.mapper.ProtWarningInfoMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import java.util.Date; @Configuration @EnableScheduling public class ProtTimer { @Autowired private ProtThresholdMapper protThresholdMapper; @Autowired private ProtDataMapper protDataMapper; @Autowired private ProtWarningInfoMapper warningInfoMapper; // 环保数据 @Scheduled(cron = "0 0 */1 * * ? ") private void getShenChan() throws Exception { for (int i = 1; i < 10; i++) { //假设已经拿到了数据 String num = NumberUtils.getNumFloat(6.4, 8.6);//ph ProtData protData = new ProtData(); protData.setCreateDate(new Date()); if (i < 4) { protData.setLoctionType(i); protData.setFarmId(21); } else if (i < 7) { protData.setLoctionType(i - 3); protData.setFarmId(24);//东阳 } else { protData.setLoctionType(i - 6); protData.setFarmId(23);//浦江 } protData.setPh(num); QueryWrapper queryWrapper = new QueryWrapper<>(); if (i == 1||i==4||i==7) { String num1 = NumberUtils.getNum(8000, 20001,0);//cod String num2 = NumberUtils.getNumFloat(1000.0, 1501.0);//nh3n String num3 = NumberUtils.getNumFloat(100.0, 260.0);//tp String num4 = NumberUtils.getNum(1000, 1550, 0);//tn String num5 = NumberUtils.getNum(0, 51, 0);//flow protData.setCod(num1); protData.setNh3n(num2); protData.setTp(num3); protData.setTn(num4); protData.setFlow(num5); protDataMapper.insert(protData); if (i == 1) { queryWrapper.eq("farm_id", 21).eq("prot_type", 1); } else if (i == 4) { queryWrapper.eq("farm_id", 24).eq("prot_type", 1); } else { queryWrapper.eq("farm_id", 23).eq("prot_type", 1); } ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//进污口 if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther3())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("进污口ph值为" + num + "达到红色预警"); protWarningInfo.setWarningType(1); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("进污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh1()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther2())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("进污口ph值为" + num + "达到橙色预警"); protWarningInfo.setWarningType(1); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("进污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod2())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("进污口cod值为" + num1 + "达到红色预警"); protWarningInfo.setWarningType(0); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("进污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod1())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("进污口cod值为" + num1 + "达到橙色预警"); protWarningInfo.setWarningType(0); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("进污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n2())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("进污口NH3N值为" + num2 + "达到红色预警"); protWarningInfo.setWarningType(2); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("进污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n1())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("进污口NH3N值为" + num2 + "达到橙色预警"); protWarningInfo.setWarningType(2); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("进污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp2())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("进污口TP值为" + num3 + "达到红色预警"); protWarningInfo.setWarningType(3); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("进污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp1())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("进污口TP值为" + num3 + "达到橙色预警"); protWarningInfo.setWarningType(3); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("进污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn2())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("进污口TN值为" + num4 + "达到红色预警"); protWarningInfo.setWarningType(4); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("进污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn1())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("进污口TN值为" + num4 + "达到橙色预警"); protWarningInfo.setWarningType(4); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("进污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow2())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("进污口累计流量值为" + num5 + "达到红色预警"); protWarningInfo.setWarningType(5); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("进污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow1())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("进污口累计流量值为" + num5 + "达到橙色预警"); protWarningInfo.setWarningType(5); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("进污口"); warningInfoMapper.insert(protWarningInfo); } } if (i == 2 || i == 5 || i == 8) { String num1 = NumberUtils.getNum(0, 310, 0);//cod String num2 = NumberUtils.getNumFloat(0.0, 31.0);//nh3n String num3 = NumberUtils.getNumFloat(0.0, 3.6);//tp String num4 = NumberUtils.getNum(0, 32, 0);//tn String num5 = NumberUtils.getNum(0, 55, 0);//flow protData.setCod(num1); protData.setNh3n(num2); protData.setTp(num3); protData.setTn(num4); protData.setFlow(num5); protDataMapper.insert(protData); if (i == 2) { queryWrapper.eq("farm_id", 21).eq("prot_type", 2); } else if (i == 5) { queryWrapper.eq("farm_id", 24).eq("prot_type", 2); } else { queryWrapper.eq("farm_id", 23).eq("prot_type", 2); } ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//污口 if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther3())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("处理口ph值为" + num + "达到红色预警"); protWarningInfo.setWarningType(1); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("处理口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh1()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther2())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("处理口ph值为" + num + "达到橙色预警"); protWarningInfo.setWarningType(1); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("处理口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod2())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("处理口cod值为" + num1 + "达到红色预警"); protWarningInfo.setWarningType(0); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("处理口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod1())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("处理口cod值为" + num1 + "达到橙色预警"); protWarningInfo.setWarningType(0); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("处理口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n2())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("处理口NH3N值为" + num2 + "达到红色预警"); protWarningInfo.setWarningType(2); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("处理口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n1())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("处理口NH3N值为" + num2 + "达到橙色预警"); protWarningInfo.setWarningType(2); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("处理口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp2())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("处理口TP值为" + num3 + "达到红色预警"); protWarningInfo.setWarningType(3); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("处理口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp1())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("处理口TP值为" + num3 + "达到橙色预警"); protWarningInfo.setWarningType(3); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("处理口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn2())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("处理口TN值为" + num4 + "达到红色预警"); protWarningInfo.setWarningType(4); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("处理口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn1())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("处理口TN值为" + num4 + "达到橙色预警"); protWarningInfo.setWarningType(4); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("处理口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow2())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("处理口累计流量值为" + num5 + "达到红色预警"); protWarningInfo.setWarningType(5); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("处理口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow1())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("处理口累计流量值为" + num5 + "达到橙色预警"); protWarningInfo.setWarningType(5); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("处理口"); warningInfoMapper.insert(protWarningInfo); } } if (i == 3 || i == 6 || i == 9) { //排污口专用数据 String ph = NumberUtils.getNumFloat(6.6, 8.4);//ph String cod = NumberUtils.getNum(0, 380, 0);//cod String nh3n = NumberUtils.getNum(0, 50, 1);//nh3n String tp = NumberUtils.getNumFloat(0.0, 10.0);//tp String tn = NumberUtils.getNum(0, 150, 1);//tn String flow = NumberUtils.getNum(0, 100, 1);//flow protData.setPh(ph); protData.setFlow(flow); protData.setTp(tp); protData.setTn(tn); protData.setCod(cod); protData.setNh3n(nh3n); protDataMapper.insert(protData); if (i == 3) { queryWrapper.eq("farm_id", 21).eq("prot_type", 3); } else if (i == 6) { queryWrapper.eq("farm_id", 24).eq("prot_type", 3); } else { queryWrapper.eq("farm_id", 23).eq("prot_type", 3); } ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//进污口 if (Double.parseDouble(ph) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(ph) < Double.parseDouble(protThreshold.getOther3())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("排污口ph值为" + ph + "达到红色预警"); protWarningInfo.setWarningType(1); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("排污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(ph) > Double.parseDouble(protThreshold.getPh1()) || Double.parseDouble(ph) < Double.parseDouble(protThreshold.getOther2())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("排污口ph值为" + ph + "达到橙色预警"); protWarningInfo.setWarningType(1); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("排污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(cod) > Double.parseDouble(protThreshold.getCod2())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("排污口cod值为" + cod + "达到红色预警"); protWarningInfo.setWarningType(0); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("排污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(cod) > Double.parseDouble(protThreshold.getCod1())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("排污口cod值为" + cod + "达到橙色预警"); protWarningInfo.setWarningType(0); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("排污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(nh3n) > Double.parseDouble(protThreshold.getNh3n2())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("排污口NH3N值为" + nh3n + "达到红色预警"); protWarningInfo.setWarningType(2); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("排污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(nh3n) > Double.parseDouble(protThreshold.getNh3n1())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("排污口NH3N值为" + nh3n + "达到橙色预警"); protWarningInfo.setWarningType(2); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("排污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(tp) > Double.parseDouble(protThreshold.getTp2())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("排污口TP值为" + tp + "达到红色预警"); protWarningInfo.setWarningType(3); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("排污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(tp) > Double.parseDouble(protThreshold.getTp1())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("排污口TP值为" + tp + "达到橙色预警"); protWarningInfo.setWarningType(3); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("排污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(tn) > Double.parseDouble(protThreshold.getTn2())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("排污口TN值为" + tn + "达到红色预警"); protWarningInfo.setWarningType(4); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("排污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(tn) > Double.parseDouble(protThreshold.getTn1())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("排污口TN值为" + tn + "达到橙色预警"); protWarningInfo.setWarningType(4); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("排污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(flow) > Double.parseDouble(protThreshold.getFlow2())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("排污口累计流量值为" + flow + "达到红色预警"); protWarningInfo.setWarningType(5); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("排污口"); warningInfoMapper.insert(protWarningInfo); } if (Double.parseDouble(flow) > Double.parseDouble(protThreshold.getFlow1())) { ProtWarningInfo protWarningInfo = new ProtWarningInfo(); protWarningInfo.setWarningContent("排污口累计流量值为" + flow + "达到橙色预警"); protWarningInfo.setWarningType(5); protWarningInfo.setFarmId(protThreshold.getFarmId()); protWarningInfo.setDate(new Date()); protWarningInfo.setUserIds(protThreshold.getUserIds()); protWarningInfo.setDeviceId(i); protWarningInfo.setBuildLocation("排污口"); warningInfoMapper.insert(protWarningInfo); } } } } }