123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499 |
- 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.GasData;
- import com.huimv.admin.entity.GasThreshold;
- import com.huimv.admin.entity.GasWarningInfo;
- import com.huimv.admin.mapper.GasDataMapper;
- import com.huimv.admin.mapper.GasThresholdMapper;
- import com.huimv.admin.mapper.GasWarningInfoMapper;
- 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 GasTimer {
- @Autowired
- private GasDataMapper gasDataMapper;
- @Autowired
- private GasWarningInfoMapper warningInfoMapper;
- @Autowired
- private GasThresholdMapper thresholdMapper;
- // @Scheduled(cron = "0 0 */1 * * ? ")
- @Scheduled(cron = "0 */1 * * * ? ")
- // @Scheduled(cron = "0 0/2 * * * ? ")
- private void getShenChan() throws Exception {
- String type = NumberUtils.getNum(1, 5, 0);//loc_type
- for (int i = 1; i < 33; i++) {
- String nh3n = NumberUtils.getNumFloat3(0.011, 0.200);//NH3N
- String jlm = NumberUtils.getNumFloat(0.0, 10.5);//jlm
- String elht = NumberUtils.getNumFloat(0.0, 10.5);//elht
- String ejel = NumberUtils.getNumFloat(0.0, 10.5);//ejel
- String h2s = NumberUtils.getNumFloat(0.0, 10.5);//h2s
- String byx = NumberUtils.getNumFloat(0.0, 20.5);//byx
- String ch3 = NumberUtils.getNumFloat(0.0, 10.5);//ch3
- String sja = NumberUtils.getNumFloat(0.0, 10.5);//sja
- GasData gasData = new GasData();
- gasData.setNh3N(nh3n);
- gasData.setJlm(jlm);
- gasData.setElht(elht);
- gasData.setEjel(ejel);
- gasData.setH2s(h2s);
- gasData.setByx(byx);
- gasData.setCh3sh(ch3);
- gasData.setSja(sja);
- if (i > 28) {
- gasData.setLoctionType(i - 28);//下水碓
- gasData.setFarmId(39);
- } else if (i > 24) {
- gasData.setLoctionType(i - 24);//下水碓
- gasData.setFarmId(22);
- } else if (i > 20) {
- gasData.setLoctionType(i - 20);//平望
- gasData.setFarmId(28);
- } else if (i > 16) {
- gasData.setLoctionType(i - 16);//天台
- gasData.setFarmId(27);
- } else if (i > 12) {
- gasData.setLoctionType(i - 12);//横路
- gasData.setFarmId(26);
- } else if (i > 8) {
- gasData.setLoctionType(i - 8);//浦江
- gasData.setFarmId(23);
- } else if (i > 4) {
- gasData.setLoctionType(i - 4);//东阳
- gasData.setFarmId(24);
- } else {
- gasData.setLoctionType(i);
- gasData.setFarmId(21);
- }
- gasData.setCreateTime(new Date());
- QueryWrapper<GasThreshold> queryWrapper = new QueryWrapper<>();
- GasWarningInfo warningInfo = new GasWarningInfo();
- if (i == 1 || i == 5 || i == 9 || i == 13 || i == 17 || i == 21 || i == 25|| i == 29) {
- String cq = NumberUtils.getNumFloat(0.0, 1000.5);//cq
- gasData.setCq(cq);
- if (i == 1) {
- queryWrapper.eq("farm_id", 21).eq("gas_type", 1);
- } else if (i == 5) {
- queryWrapper.eq("farm_id", 24).eq("gas_type", 1);
- } else if (i == 9) {
- queryWrapper.eq("farm_id", 23).eq("gas_type", 1);
- } else if (i == 13) {
- queryWrapper.eq("farm_id", 26).eq("gas_type", 1);
- } else if (i == 17) {
- queryWrapper.eq("farm_id", 27).eq("gas_type", 1);
- } else if (i == 21) {
- queryWrapper.eq("farm_id", 28).eq("gas_type", 1);
- }else if (i == 25) {
- queryWrapper.eq("farm_id", 22).eq("gas_type", 1);
- } else {
- queryWrapper.eq("farm_id", 39).eq("gas_type", 1);
- }
- GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
- if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
- warningInfo.setWarningContent("NH3N为" + nh3n + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(0);
- warningInfo.setBuildLocation("屋顶");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(jlm) > Double.parseDouble(gasThreshold.getJlm())) {
- warningInfo.setWarningContent("甲硫醚为" + jlm + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(1);
- warningInfo.setBuildLocation("屋顶");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(elht) > Double.parseDouble(gasThreshold.getElht())) {
- warningInfo.setWarningContent("二硫化碳为" + elht + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(2);
- warningInfo.setBuildLocation("屋顶");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(ejel) > Double.parseDouble(gasThreshold.getEjel())) {
- warningInfo.setWarningContent("二甲二硫为" + ejel + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(3);
- warningInfo.setBuildLocation("屋顶");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(h2s) > Double.parseDouble(gasThreshold.getH2s())) {
- warningInfo.setWarningContent("H2S为" + h2s + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(4);
- warningInfo.setBuildLocation("屋顶");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(byx) > Double.parseDouble(gasThreshold.getByx())) {
- warningInfo.setWarningContent("苯乙烯为" + byx + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(5);
- warningInfo.setBuildLocation("屋顶");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(ch3) > Double.parseDouble(gasThreshold.getCh3sh())) {
- warningInfo.setWarningContent("CH3SH为" + ch3 + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(6);
- warningInfo.setBuildLocation("屋顶");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(sja) > Double.parseDouble(gasThreshold.getSja())) {
- warningInfo.setWarningContent("三甲胺为" + sja + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(7);
- warningInfo.setBuildLocation("屋顶");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(cq) > Double.parseDouble(gasThreshold.getCq())) {
- warningInfo.setWarningContent("臭气为" + cq + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(8);
- warningInfo.setBuildLocation("屋顶");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- } else if (i == 2 || i == 6 || i == 10 || i == 14 || i == 18 || i == 22 || i == 26) {
- String cq = NumberUtils.getNumFloat(0.0, 5000.5);//cq
- gasData.setCq(cq);
- if (i == 2) {
- queryWrapper.eq("farm_id", 21).eq("gas_type", 2);
- } else if (i == 6) {
- queryWrapper.eq("farm_id", 24).eq("gas_type", 2);
- } else if (i == 10) {
- queryWrapper.eq("farm_id", 23).eq("gas_type", 2);
- } else if (i == 14) {
- queryWrapper.eq("farm_id", 26).eq("gas_type", 2);
- } else if (i == 18) {
- queryWrapper.eq("farm_id", 27).eq("gas_type", 2);
- } else if (i == 22) {
- queryWrapper.eq("farm_id", 28).eq("gas_type", 2);
- } else {
- queryWrapper.eq("farm_id", 22).eq("gas_type", 2);
- }
- GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
- if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
- warningInfo.setWarningContent("NH3N为" + nh3n + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(0);
- warningInfo.setBuildLocation("厂界上");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(jlm) > Double.parseDouble(gasThreshold.getJlm())) {
- warningInfo.setWarningContent("甲硫醚为" + jlm + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(1);
- warningInfo.setBuildLocation("厂界上");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(elht) > Double.parseDouble(gasThreshold.getElht())) {
- warningInfo.setWarningContent("二硫化碳为" + elht + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(2);
- warningInfo.setBuildLocation("厂界上");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(ejel) > Double.parseDouble(gasThreshold.getEjel())) {
- warningInfo.setWarningContent("二甲二硫为" + ejel + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(3);
- warningInfo.setBuildLocation("厂界上");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(h2s) > Double.parseDouble(gasThreshold.getH2s())) {
- warningInfo.setWarningContent("H2S为" + h2s + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(4);
- warningInfo.setBuildLocation("厂界上");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(byx) > Double.parseDouble(gasThreshold.getByx())) {
- warningInfo.setWarningContent("苯乙烯为" + byx + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(5);
- warningInfo.setBuildLocation("厂界上");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(ch3) > Double.parseDouble(gasThreshold.getCh3sh())) {
- warningInfo.setWarningContent("CH3SH为" + ch3 + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(6);
- warningInfo.setBuildLocation("厂界上");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(sja) > Double.parseDouble(gasThreshold.getSja())) {
- warningInfo.setWarningContent("三甲胺为" + sja + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(7);
- warningInfo.setBuildLocation("厂界上");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(cq) > Double.parseDouble(gasThreshold.getCq())) {
- warningInfo.setWarningContent("臭气为" + cq + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(8);
- warningInfo.setBuildLocation("厂界上");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- } else if (i == 3 || i == 7 || i == 11 || i == 15 || i == 19 || i == 23 || i == 27) {
- String cq = NumberUtils.getNumFloat(0.0, 1000.5);//cq
- gasData.setCq(cq);
- if (i == 3) {
- queryWrapper.eq("farm_id", 21).eq("gas_type", 3);
- } else if (i == 7) {
- queryWrapper.eq("farm_id", 24).eq("gas_type", 3);
- } else if (i == 11) {
- queryWrapper.eq("farm_id", 23).eq("gas_type", 3);
- } else if (i == 15) {
- queryWrapper.eq("farm_id", 26).eq("gas_type", 3);
- } else if (i == 19) {
- queryWrapper.eq("farm_id", 27).eq("gas_type", 3);
- } else if (i == 23) {
- queryWrapper.eq("farm_id", 28).eq("gas_type", 3);
- } else {
- queryWrapper.eq("farm_id", 22).eq("gas_type", 3);
- }
- GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
- if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
- warningInfo.setWarningContent("NH3N为" + nh3n + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(0);
- warningInfo.setBuildLocation("厂界下");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(jlm) > Double.parseDouble(gasThreshold.getJlm())) {
- warningInfo.setWarningContent("甲硫醚为" + jlm + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(1);
- warningInfo.setBuildLocation("厂界下");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(elht) > Double.parseDouble(gasThreshold.getElht())) {
- warningInfo.setWarningContent("二硫化碳为" + elht + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(2);
- warningInfo.setBuildLocation("厂界下");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(ejel) > Double.parseDouble(gasThreshold.getEjel())) {
- warningInfo.setWarningContent("二甲二硫为" + ejel + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(3);
- warningInfo.setBuildLocation("厂界下");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(h2s) > Double.parseDouble(gasThreshold.getH2s())) {
- warningInfo.setWarningContent("H2S为" + h2s + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(4);
- warningInfo.setBuildLocation("厂界下");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(byx) > Double.parseDouble(gasThreshold.getByx())) {
- warningInfo.setWarningContent("苯乙烯为" + byx + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(5);
- warningInfo.setBuildLocation("厂界下");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(ch3) > Double.parseDouble(gasThreshold.getCh3sh())) {
- warningInfo.setWarningContent("CH3SH为" + ch3 + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(6);
- warningInfo.setBuildLocation("厂界下");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(sja) > Double.parseDouble(gasThreshold.getSja())) {
- warningInfo.setWarningContent("三甲胺为" + sja + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(7);
- warningInfo.setBuildLocation("厂界下");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(cq) > Double.parseDouble(gasThreshold.getCq())) {
- warningInfo.setWarningContent("臭气为" + cq + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(8);
- warningInfo.setBuildLocation("厂界下");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- } else if (i == 4 || i == 8 || i == 12 || i == 16 || i == 20 || i == 24 || i == 28) {
- String cq = NumberUtils.getNumFloat(0.0, 10000.5);//cq
- gasData.setCq(cq);
- if (i == 4) {
- queryWrapper.eq("farm_id", 21).eq("gas_type", 4);
- } else if (i == 8) {
- queryWrapper.eq("farm_id", 24).eq("gas_type", 4);
- } else if (i == 12) {
- queryWrapper.eq("farm_id", 23).eq("gas_type", 4);
- } else if (i == 16) {
- queryWrapper.eq("farm_id", 26).eq("gas_type", 4);
- } else if (i == 20) {
- queryWrapper.eq("farm_id", 27).eq("gas_type", 4);
- } else if (i == 24) {
- queryWrapper.eq("farm_id", 28).eq("gas_type", 4);
- } else {
- queryWrapper.eq("farm_id", 22).eq("gas_type", 4);
- }
- GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
- if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
- warningInfo.setWarningContent("NH3N为" + nh3n + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(0);
- warningInfo.setBuildLocation("厂界居民");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(jlm) > Double.parseDouble(gasThreshold.getJlm())) {
- warningInfo.setWarningContent("甲硫醚为" + jlm + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(1);
- warningInfo.setBuildLocation("厂界居民");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(elht) > Double.parseDouble(gasThreshold.getElht())) {
- warningInfo.setWarningContent("二硫化碳为" + elht + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(2);
- warningInfo.setBuildLocation("厂界居民");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(ejel) > Double.parseDouble(gasThreshold.getEjel())) {
- warningInfo.setWarningContent("二甲二硫为" + ejel + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(3);
- warningInfo.setBuildLocation("厂界居民");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(h2s) > Double.parseDouble(gasThreshold.getH2s())) {
- warningInfo.setWarningContent("H2S为" + h2s + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(4);
- warningInfo.setBuildLocation("厂界居民");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(byx) > Double.parseDouble(gasThreshold.getByx())) {
- warningInfo.setWarningContent("苯乙烯为" + byx + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(5);
- warningInfo.setBuildLocation("厂界居民");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(ch3) > Double.parseDouble(gasThreshold.getCh3sh())) {
- warningInfo.setWarningContent("CH3SH为" + ch3 + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(6);
- warningInfo.setBuildLocation("厂界居民");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(sja) > Double.parseDouble(gasThreshold.getSja())) {
- warningInfo.setWarningContent("三甲胺为" + sja + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(7);
- warningInfo.setBuildLocation("厂界居民");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- if (Double.parseDouble(cq) > Double.parseDouble(gasThreshold.getCq())) {
- warningInfo.setWarningContent("臭气为" + cq + "超过阈值,系统预警提醒");
- warningInfo.setWarningType(8);
- warningInfo.setBuildLocation("厂界居民");
- warningInfo.setDate(new Date());
- warningInfo.setFarmId(gasThreshold.getFarmId());
- warningInfo.setUserIds(gasThreshold.getUserIds());
- warningInfoMapper.insert(warningInfo);
- }
- }
- gasDataMapper.insert(gasData);
- }
- }
- }
|