GasTimer.java 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. package com.huimv.admin.timer;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.huimv.admin.common.utils.NumberUtils;
  4. import com.huimv.admin.entity.GasData;
  5. import com.huimv.admin.entity.GasThreshold;
  6. import com.huimv.admin.entity.GasWarningInfo;
  7. import com.huimv.admin.mapper.GasDataMapper;
  8. import com.huimv.admin.mapper.GasThresholdMapper;
  9. import com.huimv.admin.mapper.GasWarningInfoMapper;
  10. import org.springframework.beans.factory.annotation.Autowired;
  11. import org.springframework.context.annotation.Configuration;
  12. import org.springframework.scheduling.annotation.EnableScheduling;
  13. import org.springframework.scheduling.annotation.Scheduled;
  14. import java.util.Date;
  15. @Configuration
  16. @EnableScheduling
  17. public class GasTimer {
  18. @Autowired
  19. private GasDataMapper gasDataMapper;
  20. @Autowired
  21. private GasWarningInfoMapper warningInfoMapper;
  22. @Autowired
  23. private GasThresholdMapper thresholdMapper;
  24. @Scheduled(cron = "0 0 */1 * * ? ")
  25. private void getShenChan() throws Exception {
  26. String type = NumberUtils.getNum(1, 5, 0);//loc_type
  27. for (int i = 1; i < 17; i++) {
  28. String nh3n = NumberUtils.getNumFloat(0.0, 10.5);//NH3N
  29. String jlm = NumberUtils.getNumFloat(0.0, 10.5);//jlm
  30. String elht = NumberUtils.getNumFloat(0.0, 10.5);//elht
  31. String ejel = NumberUtils.getNumFloat(0.0, 10.5);//ejel
  32. String h2s = NumberUtils.getNumFloat(0.0, 10.5);//h2s
  33. String byx = NumberUtils.getNumFloat(0.0, 20.5);//byx
  34. String ch3 = NumberUtils.getNumFloat(0.0, 10.5);//ch3
  35. String sja = NumberUtils.getNumFloat(0.0,10.5);//sja
  36. GasData gasData = new GasData();
  37. gasData.setNh3N(nh3n);
  38. gasData.setJlm(jlm);
  39. gasData.setElht(elht);
  40. gasData.setEjel(ejel);
  41. gasData.setH2s(h2s);
  42. gasData.setByx(byx);
  43. gasData.setCh3sh(ch3);
  44. gasData.setSja(sja);
  45. if (i > 12) {
  46. gasData.setLoctionType(i - 12);//横路
  47. gasData.setFarmId(26);
  48. } else if (i > 8) {
  49. gasData.setLoctionType(i - 8);//浦江
  50. gasData.setFarmId(23);
  51. } else if (i > 4) {
  52. gasData.setLoctionType(i - 4);//东阳
  53. gasData.setFarmId(24);
  54. } else {
  55. gasData.setLoctionType(i);
  56. gasData.setFarmId(21);
  57. }
  58. gasData.setCreateTime(new Date());
  59. QueryWrapper<GasThreshold> queryWrapper = new QueryWrapper<>();
  60. GasWarningInfo warningInfo = new GasWarningInfo();
  61. if (i==1||i==5||i==9||i==13) {
  62. String cq = NumberUtils.getNumFloat(0.0, 1000.5);//cq
  63. gasData.setCq(cq);
  64. if (i == 1) {
  65. queryWrapper.eq("farm_id", 21).eq("gas_type", 1);
  66. } else if (i == 5) {
  67. queryWrapper.eq("farm_id", 24).eq("gas_type", 1);
  68. } else if (i == 9) {
  69. queryWrapper.eq("farm_id", 23).eq("gas_type", 1);
  70. } else {
  71. queryWrapper.eq("farm_id", 26).eq("gas_type", 1);
  72. }
  73. GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
  74. if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
  75. warningInfo.setWarningContent("NH3N为"+nh3n + "超过阈值,系统预警提醒");
  76. warningInfo.setWarningType(0);
  77. warningInfo.setBuildLocation("屋顶");
  78. warningInfo.setDate(new Date());
  79. warningInfo.setFarmId(gasThreshold.getFarmId());
  80. warningInfo.setUserIds(gasThreshold.getUserIds());
  81. warningInfoMapper.insert(warningInfo);
  82. }
  83. if (Double.parseDouble(jlm) > Double.parseDouble(gasThreshold.getJlm())) {
  84. warningInfo.setWarningContent("甲硫醚为"+jlm + "超过阈值,系统预警提醒");
  85. warningInfo.setWarningType(1);
  86. warningInfo.setBuildLocation("屋顶");
  87. warningInfo.setDate(new Date());
  88. warningInfo.setFarmId(gasThreshold.getFarmId());
  89. warningInfo.setUserIds(gasThreshold.getUserIds());
  90. warningInfoMapper.insert(warningInfo);
  91. }
  92. if (Double.parseDouble(elht) > Double.parseDouble(gasThreshold.getElht())) {
  93. warningInfo.setWarningContent("二硫化碳为"+elht + "超过阈值,系统预警提醒");
  94. warningInfo.setWarningType(2);
  95. warningInfo.setBuildLocation("屋顶");
  96. warningInfo.setDate(new Date());
  97. warningInfo.setFarmId(gasThreshold.getFarmId());
  98. warningInfo.setUserIds(gasThreshold.getUserIds());
  99. warningInfoMapper.insert(warningInfo);
  100. }
  101. if (Double.parseDouble(ejel) > Double.parseDouble(gasThreshold.getEjel())) {
  102. warningInfo.setWarningContent("二甲二硫为"+ejel + "超过阈值,系统预警提醒");
  103. warningInfo.setWarningType(3);
  104. warningInfo.setBuildLocation("屋顶");
  105. warningInfo.setDate(new Date());
  106. warningInfo.setFarmId(gasThreshold.getFarmId());
  107. warningInfo.setUserIds(gasThreshold.getUserIds());
  108. warningInfoMapper.insert(warningInfo);
  109. }
  110. if (Double.parseDouble(h2s) > Double.parseDouble(gasThreshold.getH2s())) {
  111. warningInfo.setWarningContent("H2S为"+h2s + "超过阈值,系统预警提醒");
  112. warningInfo.setWarningType(4);
  113. warningInfo.setBuildLocation("屋顶");
  114. warningInfo.setDate(new Date());
  115. warningInfo.setFarmId(gasThreshold.getFarmId());
  116. warningInfo.setUserIds(gasThreshold.getUserIds());
  117. warningInfoMapper.insert(warningInfo);
  118. }
  119. if (Double.parseDouble(byx) > Double.parseDouble(gasThreshold.getByx())) {
  120. warningInfo.setWarningContent("苯乙烯为"+byx + "超过阈值,系统预警提醒");
  121. warningInfo.setWarningType(5);
  122. warningInfo.setBuildLocation("屋顶");
  123. warningInfo.setDate(new Date());
  124. warningInfo.setFarmId(gasThreshold.getFarmId());
  125. warningInfo.setUserIds(gasThreshold.getUserIds());
  126. warningInfoMapper.insert(warningInfo);
  127. }
  128. if (Double.parseDouble(ch3) > Double.parseDouble(gasThreshold.getCh3sh())) {
  129. warningInfo.setWarningContent("CH3SH为"+ch3 + "超过阈值,系统预警提醒");
  130. warningInfo.setWarningType(6);
  131. warningInfo.setBuildLocation("屋顶");
  132. warningInfo.setDate(new Date());
  133. warningInfo.setFarmId(gasThreshold.getFarmId());
  134. warningInfo.setUserIds(gasThreshold.getUserIds());
  135. warningInfoMapper.insert(warningInfo);
  136. }
  137. if (Double.parseDouble(sja) > Double.parseDouble(gasThreshold.getSja())) {
  138. warningInfo.setWarningContent("三甲胺为"+sja + "超过阈值,系统预警提醒");
  139. warningInfo.setWarningType(7);
  140. warningInfo.setBuildLocation("屋顶");
  141. warningInfo.setDate(new Date());
  142. warningInfo.setFarmId(gasThreshold.getFarmId());
  143. warningInfo.setUserIds(gasThreshold.getUserIds());
  144. warningInfoMapper.insert(warningInfo);
  145. }
  146. if (Double.parseDouble(cq) > Double.parseDouble(gasThreshold.getCq())) {
  147. warningInfo.setWarningContent("臭气为"+cq + "超过阈值,系统预警提醒");
  148. warningInfo.setWarningType(8);
  149. warningInfo.setBuildLocation("屋顶");
  150. warningInfo.setDate(new Date());
  151. warningInfo.setFarmId(gasThreshold.getFarmId());
  152. warningInfo.setUserIds(gasThreshold.getUserIds());
  153. warningInfoMapper.insert(warningInfo);
  154. }
  155. } else if (i==2||i==6||i==10||i==14) {
  156. String cq = NumberUtils.getNumFloat(0.0, 5000.5);//cq
  157. gasData.setCq(cq);
  158. if (i == 2) {
  159. queryWrapper.eq("farm_id", 21).eq("gas_type", 2);
  160. } else if (i == 6) {
  161. queryWrapper.eq("farm_id", 24).eq("gas_type", 2);
  162. } else if (i == 10) {
  163. queryWrapper.eq("farm_id", 23).eq("gas_type", 2);
  164. } else {
  165. queryWrapper.eq("farm_id", 26).eq("gas_type", 2);
  166. }
  167. GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
  168. if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
  169. warningInfo.setWarningContent("NH3N为"+nh3n + "超过阈值,系统预警提醒");
  170. warningInfo.setWarningType(0);
  171. warningInfo.setBuildLocation("厂界上");
  172. warningInfo.setDate(new Date());
  173. warningInfo.setFarmId(gasThreshold.getFarmId());
  174. warningInfo.setUserIds(gasThreshold.getUserIds());
  175. warningInfoMapper.insert(warningInfo);
  176. }
  177. if (Double.parseDouble(jlm) > Double.parseDouble(gasThreshold.getJlm())) {
  178. warningInfo.setWarningContent("甲硫醚为"+jlm + "超过阈值,系统预警提醒");
  179. warningInfo.setWarningType(1);
  180. warningInfo.setBuildLocation("厂界上");
  181. warningInfo.setDate(new Date());
  182. warningInfo.setFarmId(gasThreshold.getFarmId());
  183. warningInfo.setUserIds(gasThreshold.getUserIds());
  184. warningInfoMapper.insert(warningInfo);
  185. }
  186. if (Double.parseDouble(elht) > Double.parseDouble(gasThreshold.getElht())) {
  187. warningInfo.setWarningContent("二硫化碳为"+elht + "超过阈值,系统预警提醒");
  188. warningInfo.setWarningType(2);
  189. warningInfo.setBuildLocation("厂界上");
  190. warningInfo.setDate(new Date());
  191. warningInfo.setFarmId(gasThreshold.getFarmId());
  192. warningInfo.setUserIds(gasThreshold.getUserIds());
  193. warningInfoMapper.insert(warningInfo);
  194. }
  195. if (Double.parseDouble(ejel) > Double.parseDouble(gasThreshold.getEjel())) {
  196. warningInfo.setWarningContent("二甲二硫为"+ejel + "超过阈值,系统预警提醒");
  197. warningInfo.setWarningType(3);
  198. warningInfo.setBuildLocation("厂界上");
  199. warningInfo.setDate(new Date());
  200. warningInfo.setFarmId(gasThreshold.getFarmId());
  201. warningInfo.setUserIds(gasThreshold.getUserIds());
  202. warningInfoMapper.insert(warningInfo);
  203. }
  204. if (Double.parseDouble(h2s) > Double.parseDouble(gasThreshold.getH2s())) {
  205. warningInfo.setWarningContent("H2S为"+h2s + "超过阈值,系统预警提醒");
  206. warningInfo.setWarningType(4);
  207. warningInfo.setBuildLocation("厂界上");
  208. warningInfo.setDate(new Date());
  209. warningInfo.setFarmId(gasThreshold.getFarmId());
  210. warningInfo.setUserIds(gasThreshold.getUserIds());
  211. warningInfoMapper.insert(warningInfo);
  212. }
  213. if (Double.parseDouble(byx) > Double.parseDouble(gasThreshold.getByx())) {
  214. warningInfo.setWarningContent("苯乙烯为"+byx + "超过阈值,系统预警提醒");
  215. warningInfo.setWarningType(5);
  216. warningInfo.setBuildLocation("厂界上");
  217. warningInfo.setDate(new Date());
  218. warningInfo.setFarmId(gasThreshold.getFarmId());
  219. warningInfo.setUserIds(gasThreshold.getUserIds());
  220. warningInfoMapper.insert(warningInfo);
  221. }
  222. if (Double.parseDouble(ch3) > Double.parseDouble(gasThreshold.getCh3sh())) {
  223. warningInfo.setWarningContent("CH3SH为"+ch3 + "超过阈值,系统预警提醒");
  224. warningInfo.setWarningType(6);
  225. warningInfo.setBuildLocation("厂界上");
  226. warningInfo.setDate(new Date());
  227. warningInfo.setFarmId(gasThreshold.getFarmId());
  228. warningInfo.setUserIds(gasThreshold.getUserIds());
  229. warningInfoMapper.insert(warningInfo);
  230. }
  231. if (Double.parseDouble(sja) > Double.parseDouble(gasThreshold.getSja())) {
  232. warningInfo.setWarningContent("三甲胺为"+sja + "超过阈值,系统预警提醒");
  233. warningInfo.setWarningType(7);
  234. warningInfo.setBuildLocation("厂界上");
  235. warningInfo.setDate(new Date());
  236. warningInfo.setFarmId(gasThreshold.getFarmId());
  237. warningInfo.setUserIds(gasThreshold.getUserIds());
  238. warningInfoMapper.insert(warningInfo);
  239. }
  240. if (Double.parseDouble(cq) > Double.parseDouble(gasThreshold.getCq())) {
  241. warningInfo.setWarningContent("臭气为"+cq + "超过阈值,系统预警提醒");
  242. warningInfo.setWarningType(8);
  243. warningInfo.setBuildLocation("厂界上");
  244. warningInfo.setDate(new Date());
  245. warningInfo.setFarmId(gasThreshold.getFarmId());
  246. warningInfo.setUserIds(gasThreshold.getUserIds());
  247. warningInfoMapper.insert(warningInfo);
  248. }
  249. } else if (i==3||i==7||i==11||i==15) {
  250. String cq = NumberUtils.getNumFloat(0.0, 1000.5);//cq
  251. gasData.setCq(cq);
  252. if (i == 3) {
  253. queryWrapper.eq("farm_id", 21).eq("gas_type", 3);
  254. } else if (i == 7) {
  255. queryWrapper.eq("farm_id", 24).eq("gas_type", 3);
  256. } else if (i == 11) {
  257. queryWrapper.eq("farm_id", 23).eq("gas_type", 3);
  258. } else {
  259. queryWrapper.eq("farm_id", 26).eq("gas_type", 3);
  260. }
  261. GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
  262. if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
  263. warningInfo.setWarningContent("NH3N为"+nh3n + "超过阈值,系统预警提醒");
  264. warningInfo.setWarningType(0);
  265. warningInfo.setBuildLocation("厂界下");
  266. warningInfo.setDate(new Date());
  267. warningInfo.setFarmId(gasThreshold.getFarmId());
  268. warningInfo.setUserIds(gasThreshold.getUserIds());
  269. warningInfoMapper.insert(warningInfo);
  270. }
  271. if (Double.parseDouble(jlm) > Double.parseDouble(gasThreshold.getJlm())) {
  272. warningInfo.setWarningContent("甲硫醚为"+jlm + "超过阈值,系统预警提醒");
  273. warningInfo.setWarningType(1);
  274. warningInfo.setBuildLocation("厂界下");
  275. warningInfo.setDate(new Date());
  276. warningInfo.setFarmId(gasThreshold.getFarmId());
  277. warningInfo.setUserIds(gasThreshold.getUserIds());
  278. warningInfoMapper.insert(warningInfo);
  279. }
  280. if (Double.parseDouble(elht) > Double.parseDouble(gasThreshold.getElht())) {
  281. warningInfo.setWarningContent("二硫化碳为"+elht + "超过阈值,系统预警提醒");
  282. warningInfo.setWarningType(2);
  283. warningInfo.setBuildLocation("厂界下");
  284. warningInfo.setDate(new Date());
  285. warningInfo.setFarmId(gasThreshold.getFarmId());
  286. warningInfo.setUserIds(gasThreshold.getUserIds());
  287. warningInfoMapper.insert(warningInfo);
  288. }
  289. if (Double.parseDouble(ejel) > Double.parseDouble(gasThreshold.getEjel())) {
  290. warningInfo.setWarningContent("二甲二硫为"+ejel + "超过阈值,系统预警提醒");
  291. warningInfo.setWarningType(3);
  292. warningInfo.setBuildLocation("厂界下");
  293. warningInfo.setDate(new Date());
  294. warningInfo.setFarmId(gasThreshold.getFarmId());
  295. warningInfo.setUserIds(gasThreshold.getUserIds());
  296. warningInfoMapper.insert(warningInfo);
  297. }
  298. if (Double.parseDouble(h2s) > Double.parseDouble(gasThreshold.getH2s())) {
  299. warningInfo.setWarningContent("H2S为"+h2s + "超过阈值,系统预警提醒");
  300. warningInfo.setWarningType(4);
  301. warningInfo.setBuildLocation("厂界下");
  302. warningInfo.setDate(new Date());
  303. warningInfo.setFarmId(gasThreshold.getFarmId());
  304. warningInfo.setUserIds(gasThreshold.getUserIds());
  305. warningInfoMapper.insert(warningInfo);
  306. }
  307. if (Double.parseDouble(byx) > Double.parseDouble(gasThreshold.getByx())) {
  308. warningInfo.setWarningContent("苯乙烯为"+byx + "超过阈值,系统预警提醒");
  309. warningInfo.setWarningType(5);
  310. warningInfo.setBuildLocation("厂界下");
  311. warningInfo.setDate(new Date());
  312. warningInfo.setFarmId(gasThreshold.getFarmId());
  313. warningInfo.setUserIds(gasThreshold.getUserIds());
  314. warningInfoMapper.insert(warningInfo);
  315. }
  316. if (Double.parseDouble(ch3) > Double.parseDouble(gasThreshold.getCh3sh())) {
  317. warningInfo.setWarningContent("CH3SH为"+ch3 + "超过阈值,系统预警提醒");
  318. warningInfo.setWarningType(6);
  319. warningInfo.setBuildLocation("厂界下");
  320. warningInfo.setDate(new Date());
  321. warningInfo.setFarmId(gasThreshold.getFarmId());
  322. warningInfo.setUserIds(gasThreshold.getUserIds());
  323. warningInfoMapper.insert(warningInfo);
  324. }
  325. if (Double.parseDouble(sja) > Double.parseDouble(gasThreshold.getSja())) {
  326. warningInfo.setWarningContent("三甲胺为"+sja + "超过阈值,系统预警提醒");
  327. warningInfo.setWarningType(7);
  328. warningInfo.setBuildLocation("厂界下");
  329. warningInfo.setDate(new Date());
  330. warningInfo.setFarmId(gasThreshold.getFarmId());
  331. warningInfo.setUserIds(gasThreshold.getUserIds());
  332. warningInfoMapper.insert(warningInfo);
  333. }
  334. if (Double.parseDouble(cq) > Double.parseDouble(gasThreshold.getCq())) {
  335. warningInfo.setWarningContent("臭气为"+cq + "超过阈值,系统预警提醒");
  336. warningInfo.setWarningType(8);
  337. warningInfo.setBuildLocation("厂界下");
  338. warningInfo.setDate(new Date());
  339. warningInfo.setFarmId(gasThreshold.getFarmId());
  340. warningInfo.setUserIds(gasThreshold.getUserIds());
  341. warningInfoMapper.insert(warningInfo);
  342. }
  343. } else if (i==4||i==8||i==12||i==16) {
  344. String cq = NumberUtils.getNumFloat(0.0, 10000.5);//cq
  345. gasData.setCq(cq);
  346. if (i == 4) {
  347. queryWrapper.eq("farm_id", 21).eq("gas_type", 4);
  348. } else if (i == 8) {
  349. queryWrapper.eq("farm_id", 24).eq("gas_type", 4);
  350. } else if (i == 12) {
  351. queryWrapper.eq("farm_id", 23).eq("gas_type", 4);
  352. } else {
  353. queryWrapper.eq("farm_id", 26).eq("gas_type", 4);
  354. }
  355. GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
  356. if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
  357. warningInfo.setWarningContent("NH3N为"+nh3n + "超过阈值,系统预警提醒");
  358. warningInfo.setWarningType(0);
  359. warningInfo.setBuildLocation("厂界居民");
  360. warningInfo.setDate(new Date());
  361. warningInfo.setFarmId(gasThreshold.getFarmId());
  362. warningInfo.setUserIds(gasThreshold.getUserIds());
  363. warningInfoMapper.insert(warningInfo);
  364. }
  365. if (Double.parseDouble(jlm) > Double.parseDouble(gasThreshold.getJlm())) {
  366. warningInfo.setWarningContent("甲硫醚为"+jlm + "超过阈值,系统预警提醒");
  367. warningInfo.setWarningType(1);
  368. warningInfo.setBuildLocation("厂界居民");
  369. warningInfo.setDate(new Date());
  370. warningInfo.setFarmId(gasThreshold.getFarmId());
  371. warningInfo.setUserIds(gasThreshold.getUserIds());
  372. warningInfoMapper.insert(warningInfo);
  373. }
  374. if (Double.parseDouble(elht) > Double.parseDouble(gasThreshold.getElht())) {
  375. warningInfo.setWarningContent("二硫化碳为"+elht + "超过阈值,系统预警提醒");
  376. warningInfo.setWarningType(2);
  377. warningInfo.setBuildLocation("厂界居民");
  378. warningInfo.setDate(new Date());
  379. warningInfo.setFarmId(gasThreshold.getFarmId());
  380. warningInfo.setUserIds(gasThreshold.getUserIds());
  381. warningInfoMapper.insert(warningInfo);
  382. }
  383. if (Double.parseDouble(ejel) > Double.parseDouble(gasThreshold.getEjel())) {
  384. warningInfo.setWarningContent("二甲二硫为"+ejel + "超过阈值,系统预警提醒");
  385. warningInfo.setWarningType(3);
  386. warningInfo.setBuildLocation("厂界居民");
  387. warningInfo.setDate(new Date());
  388. warningInfo.setFarmId(gasThreshold.getFarmId());
  389. warningInfo.setUserIds(gasThreshold.getUserIds());
  390. warningInfoMapper.insert(warningInfo);
  391. }
  392. if (Double.parseDouble(h2s) > Double.parseDouble(gasThreshold.getH2s())) {
  393. warningInfo.setWarningContent("H2S为"+h2s + "超过阈值,系统预警提醒");
  394. warningInfo.setWarningType(4);
  395. warningInfo.setBuildLocation("厂界居民");
  396. warningInfo.setDate(new Date());
  397. warningInfo.setFarmId(gasThreshold.getFarmId());
  398. warningInfo.setUserIds(gasThreshold.getUserIds());
  399. warningInfoMapper.insert(warningInfo);
  400. }
  401. if (Double.parseDouble(byx) > Double.parseDouble(gasThreshold.getByx())) {
  402. warningInfo.setWarningContent("苯乙烯为"+byx + "超过阈值,系统预警提醒");
  403. warningInfo.setWarningType(5);
  404. warningInfo.setBuildLocation("厂界居民");
  405. warningInfo.setDate(new Date());
  406. warningInfo.setFarmId(gasThreshold.getFarmId());
  407. warningInfo.setUserIds(gasThreshold.getUserIds());
  408. warningInfoMapper.insert(warningInfo);
  409. }
  410. if (Double.parseDouble(ch3) > Double.parseDouble(gasThreshold.getCh3sh())) {
  411. warningInfo.setWarningContent("CH3SH为"+ch3 + "超过阈值,系统预警提醒");
  412. warningInfo.setWarningType(6);
  413. warningInfo.setBuildLocation("厂界居民");
  414. warningInfo.setDate(new Date());
  415. warningInfo.setFarmId(gasThreshold.getFarmId());
  416. warningInfo.setUserIds(gasThreshold.getUserIds());
  417. warningInfoMapper.insert(warningInfo);
  418. }
  419. if (Double.parseDouble(sja) > Double.parseDouble(gasThreshold.getSja())) {
  420. warningInfo.setWarningContent("三甲胺为"+sja + "超过阈值,系统预警提醒");
  421. warningInfo.setWarningType(7);
  422. warningInfo.setBuildLocation("厂界居民");
  423. warningInfo.setDate(new Date());
  424. warningInfo.setFarmId(gasThreshold.getFarmId());
  425. warningInfo.setUserIds(gasThreshold.getUserIds());
  426. warningInfoMapper.insert(warningInfo);
  427. }
  428. if (Double.parseDouble(cq) > Double.parseDouble(gasThreshold.getCq())) {
  429. warningInfo.setWarningContent("臭气为"+cq + "超过阈值,系统预警提醒");
  430. warningInfo.setWarningType(8);
  431. warningInfo.setBuildLocation("厂界居民");
  432. warningInfo.setDate(new Date());
  433. warningInfo.setFarmId(gasThreshold.getFarmId());
  434. warningInfo.setUserIds(gasThreshold.getUserIds());
  435. warningInfoMapper.insert(warningInfo);
  436. }
  437. }
  438. gasDataMapper.insert(gasData);
  439. }
  440. }
  441. }