123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512 |
- 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 com.huimv.admin.service.IProtDataService;
- import com.huimv.admin.service.IProtThresholdService;
- 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.text.NumberFormat;
- 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 < 4; i++) {
- //假设已经拿到了数据
- String num = NumberUtils.getNumFloat(6.4, 8.6);//ph
- ProtData protData = new ProtData();
- protData.setLoctionType(i);
- protData.setCreateDate(new Date());
- protData.setFarmId(21);
- protData.setPh(num);
- QueryWrapper<ProtThreshold> queryWrapper = new QueryWrapper<>();
- if (i == 1) {
- 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);
- queryWrapper.eq("farm_id", 21).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) {
- 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);
- queryWrapper.eq("farm_id", 21).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) {
- //排污口专用数据
- 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);
- queryWrapper.eq("farm_id", 21).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);
- }
- }
- }
- }
- }
|